Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: remove unnecessary filter for scale props #705

Merged
merged 1 commit into from
Feb 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,9 @@ LoadedCheerio {
"attribs": Object {
"autocomplete": "off",
"class": " ",
"height": "calc(2.25 * 16px)",
"placeholder": "Enter here",
"type": "text",
"value": "",
"width": "initial",
},
"children": Array [],
"name": "input",
Expand All @@ -42,20 +40,16 @@ LoadedCheerio {
"x-attribsNamespace": Object {
"autocomplete": undefined,
"class": undefined,
"height": undefined,
"placeholder": undefined,
"type": undefined,
"value": undefined,
"width": undefined,
},
"x-attribsPrefix": Object {
"autocomplete": undefined,
"class": undefined,
"height": undefined,
"placeholder": undefined,
"type": undefined,
"value": undefined,
"width": undefined,
},
},
],
Expand Down Expand Up @@ -328,11 +322,9 @@ LoadedCheerio {
"attribs": Object {
"autocomplete": "off",
"class": " ",
"height": "calc(2.25 * 16px)",
"placeholder": "Enter here",
"type": "text",
"value": "",
"width": "initial",
},
"children": Array [],
"name": "input",
Expand All @@ -344,20 +336,16 @@ LoadedCheerio {
"x-attribsNamespace": Object {
"autocomplete": undefined,
"class": undefined,
"height": undefined,
"placeholder": undefined,
"type": undefined,
"value": undefined,
"width": undefined,
},
"x-attribsPrefix": Object {
"autocomplete": undefined,
"class": undefined,
"height": undefined,
"placeholder": undefined,
"type": undefined,
"value": undefined,
"width": undefined,
},
},
],
Expand Down Expand Up @@ -481,11 +469,9 @@ LoadedCheerio {
"attribs": Object {
"autocomplete": "off",
"class": " ",
"height": "calc(2.25 * 16px)",
"placeholder": "Enter here",
"type": "text",
"value": "",
"width": "initial",
},
"children": Array [],
"name": "input",
Expand All @@ -497,20 +483,16 @@ LoadedCheerio {
"x-attribsNamespace": Object {
"autocomplete": undefined,
"class": undefined,
"height": undefined,
"placeholder": undefined,
"type": undefined,
"value": undefined,
"width": undefined,
},
"x-attribsPrefix": Object {
"autocomplete": undefined,
"class": undefined,
"height": undefined,
"placeholder": undefined,
"type": undefined,
"value": undefined,
"width": undefined,
},
},
],
Expand Down Expand Up @@ -783,11 +765,9 @@ LoadedCheerio {
"attribs": Object {
"autocomplete": "off",
"class": " ",
"height": "calc(2.25 * 16px)",
"placeholder": "Enter here",
"type": "text",
"value": "",
"width": "initial",
},
"children": Array [],
"name": "input",
Expand All @@ -799,20 +779,16 @@ LoadedCheerio {
"x-attribsNamespace": Object {
"autocomplete": undefined,
"class": undefined,
"height": undefined,
"placeholder": undefined,
"type": undefined,
"value": undefined,
"width": undefined,
},
"x-attribsPrefix": Object {
"autocomplete": undefined,
"class": undefined,
"height": undefined,
"placeholder": undefined,
"type": undefined,
"value": undefined,
"width": undefined,
},
},
],
Expand Down Expand Up @@ -999,11 +975,9 @@ LoadedCheerio {
"attribs": Object {
"autocomplete": "off",
"class": " ",
"height": "calc(2.25 * 16px)",
"placeholder": "Enter here",
"type": "text",
"value": "",
"width": "initial",
},
"children": Array [],
"name": "input",
Expand All @@ -1015,20 +989,16 @@ LoadedCheerio {
"x-attribsNamespace": Object {
"autocomplete": undefined,
"class": undefined,
"height": undefined,
"placeholder": undefined,
"type": undefined,
"value": undefined,
"width": undefined,
},
"x-attribsPrefix": Object {
"autocomplete": undefined,
"class": undefined,
"height": undefined,
"placeholder": undefined,
"type": undefined,
"value": undefined,
"width": undefined,
},
},
],
Expand Down Expand Up @@ -1301,11 +1271,9 @@ LoadedCheerio {
"attribs": Object {
"autocomplete": "off",
"class": " ",
"height": "calc(2.25 * 16px)",
"placeholder": "Enter here",
"type": "text",
"value": "",
"width": "initial",
},
"children": Array [],
"name": "input",
Expand All @@ -1317,20 +1285,16 @@ LoadedCheerio {
"x-attribsNamespace": Object {
"autocomplete": undefined,
"class": undefined,
"height": undefined,
"placeholder": undefined,
"type": undefined,
"value": undefined,
"width": undefined,
},
"x-attribsPrefix": Object {
"autocomplete": undefined,
"class": undefined,
"height": undefined,
"placeholder": undefined,
"type": undefined,
"value": undefined,
"width": undefined,
},
},
],
Expand Down Expand Up @@ -1454,11 +1418,9 @@ LoadedCheerio {
"attribs": Object {
"autocomplete": "off",
"class": " ",
"height": "calc(2.25 * 16px)",
"placeholder": "Enter here",
"type": "text",
"value": "",
"width": "initial",
},
"children": Array [],
"name": "input",
Expand All @@ -1470,20 +1432,16 @@ LoadedCheerio {
"x-attribsNamespace": Object {
"autocomplete": undefined,
"class": undefined,
"height": undefined,
"placeholder": undefined,
"type": undefined,
"value": undefined,
"width": undefined,
},
"x-attribsPrefix": Object {
"autocomplete": undefined,
"class": undefined,
"height": undefined,
"placeholder": undefined,
"type": undefined,
"value": undefined,
"width": undefined,
},
},
],
Expand Down Expand Up @@ -1756,11 +1714,9 @@ LoadedCheerio {
"attribs": Object {
"autocomplete": "off",
"class": " ",
"height": "calc(2.25 * 16px)",
"placeholder": "Enter here",
"type": "text",
"value": "",
"width": "initial",
},
"children": Array [],
"name": "input",
Expand All @@ -1772,20 +1728,16 @@ LoadedCheerio {
"x-attribsNamespace": Object {
"autocomplete": undefined,
"class": undefined,
"height": undefined,
"placeholder": undefined,
"type": undefined,
"value": undefined,
"width": undefined,
},
"x-attribsPrefix": Object {
"autocomplete": undefined,
"class": undefined,
"height": undefined,
"placeholder": undefined,
"type": undefined,
"value": undefined,
"width": undefined,
},
},
],
Expand Down
4 changes: 2 additions & 2 deletions components/auto-complete/auto-complete.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { NormalTypes } from '../utils/prop-types'
import Loading from '../loading'
import { pickChild } from '../utils/collections'
import useCurrentState from '../utils/use-current-state'
import useScale, { withPureProps, withScale } from '../use-scale'
import useScale, { withScale } from '../use-scale'

export type AutoCompleteTypes = NormalTypes

Expand Down Expand Up @@ -196,7 +196,7 @@ const AutoCompleteComponent = React.forwardRef<
}

const inputProps = {
...withPureProps(props),
...props,
disabled,
value: state,
}
Expand Down
13 changes: 3 additions & 10 deletions components/avatar/avatar.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react'
import useTheme from '../use-theme'
import useScale, { withPureProps, withScale } from '../use-scale'
import useScale, { withScale } from '../use-scale'

interface Props {
src?: string
Expand Down Expand Up @@ -41,21 +41,14 @@ const AvatarComponent: React.FC<AvatarProps> = ({
const showText = !src
const radius = isSquare ? theme.layout.radius : '50%'
const marginLeft = stacked ? SCALES.ml(-0.625) : SCALES.ml(0)
const otherProps = withPureProps(props)

return (
<span className={`avatar ${className}`}>
{!showText && (
<img
alt="avatar"
className="avatar-img"
src={src}
draggable={false}
{...otherProps}
/>
<img alt="avatar" className="avatar-img" src={src} draggable={false} {...props} />
)}
{showText && (
<span className="avatar-text" {...otherProps}>
<span className="avatar-text" {...props}>
{safeText(text)}
</span>
)}
Expand Down
4 changes: 2 additions & 2 deletions components/badge/badge.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React, { useMemo } from 'react'
import useTheme from '../use-theme'
import { NormalTypes } from '../utils/prop-types'
import { GeistUIThemesPalette } from '../themes/presets'
import useScale, { withPureProps, withScale } from '../use-scale'
import useScale, { withScale } from '../use-scale'

export type BadgeTypes = NormalTypes

Expand Down Expand Up @@ -48,7 +48,7 @@ const BadgeComponent: React.FC<React.PropsWithChildren<BadgeProps>> = ({
}, [type, theme.palette.background])

return (
<span className={`badge ${dot ? 'dot' : ''} ${className}`} {...withPureProps(props)}>
<span className={`badge ${dot ? 'dot' : ''} ${className}`} {...props}>
{!dot && children}
<style jsx>{`
.badge {
Expand Down
3 changes: 1 addition & 2 deletions components/button-dropdown/button-dropdown-item.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { getColor } from './styles'
import { useButtonDropdown } from './button-dropdown-context'
import Loading from '../loading'
import { NormalTypes } from '../utils/prop-types'
import { withPureProps } from '../use-scale'

export type ButtonDropdownItemTypes = NormalTypes

Expand Down Expand Up @@ -48,7 +47,7 @@ const ButtonDropdownItem: React.FC<React.PropsWithChildren<ButtonDropdownItemPro
}, [loading, disabled])

return (
<button className={className} onClick={clickHandler} {...withPureProps(props)}>
<button className={className} onClick={clickHandler} {...props}>
{loading ? <Loading /> : children}
<style jsx>{`
button {
Expand Down
4 changes: 2 additions & 2 deletions components/button-dropdown/button-dropdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import ButtonDropdownItem from './button-dropdown-item'
import { ButtonDropdownContext } from './button-dropdown-context'
import { NormalTypes } from '../utils/prop-types'
import { pickChild, pickChildByProps } from '../utils/collections'
import useScale, { withPureProps, withScale } from '../use-scale'
import useScale, { withScale } from '../use-scale'

export type ButtonDropdownTypes = NormalTypes

Expand Down Expand Up @@ -91,7 +91,7 @@ const ButtonDropdownComponent: React.FC<React.PropsWithChildren<ButtonDropdownPr
ref={ref}
className={`btn-dropdown ${className}`}
onClick={stopPropagation}
{...withPureProps(props)}>
{...props}>
{mainItemChildren}
<details open={visible}>
<summary onClick={clickHandler}>
Expand Down
4 changes: 2 additions & 2 deletions components/button-group/button-group.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import useTheme from '../use-theme'
import { ButtonTypes } from '../utils/prop-types'
import { ButtonGroupContext, ButtonGroupConfig } from './button-group-context'
import { GeistUIThemesPalette } from '../themes/presets'
import useScale, { withPureProps, withScale } from '../use-scale'
import useScale, { withScale } from '../use-scale'

interface Props {
disabled?: boolean
Expand Down Expand Up @@ -65,7 +65,7 @@ const ButtonGroupComponent: React.FC<React.PropsWithChildren<ButtonGroupProps>>
<ButtonGroupContext.Provider value={initialValue}>
<div
className={`btn-group ${vertical ? 'vertical' : 'horizontal'} ${className}`}
{...withPureProps(props)}>
{...props}>
{children}
<style jsx>{`
.btn-group {
Expand Down
3 changes: 1 addition & 2 deletions components/button/button-icon.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import React from 'react'
import { withPureProps } from '../use-scale'

interface Props {
isRight?: boolean
Expand Down Expand Up @@ -27,7 +26,7 @@ const ButtonIcon: React.FC<React.PropsWithChildren<ButtonIconProps>> = ({
className={`icon ${isRight ? 'right' : ''} ${
isSingle ? 'single' : ''
} ${className}`}
{...withPureProps(props)}>
{...props}>
{children}
<style jsx>{`
.icon {
Expand Down
Loading