Skip to content

Commit

Permalink
prefer object.assign
Browse files Browse the repository at this point in the history
  • Loading branch information
nandorojo committed Oct 9, 2024
1 parent 888184d commit 8e89b4b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
20 changes: 11 additions & 9 deletions packages/dripsy/src/core/css/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -183,10 +183,12 @@ export const css = (
fontFamily: fontFamilyFromProps,
...props
}: CssPropsArgument = {}): CSSObject => {
const theme: DripsyFinalTheme = {
...defaultTheme,
...('theme' in props ? props.theme : props),
} as DripsyFinalTheme
let theme = defaultTheme as DripsyFinalTheme
if ('theme' in props) {
theme = Object.assign({}, theme, props.theme)
} else {
theme = Object.assign({}, theme, props)
}
let result: CSSObject = {}
const obj = typeof args === 'function' ? args(theme) : args
const filteredOutWebKeys = filterWebStyleKeys(obj)
Expand All @@ -202,7 +204,7 @@ export const css = (
get(theme, themeKey + '.' + val, get(theme, val)),
breakpoint
)({ theme })
result = { ...result, ...variant }
Object.assign(result, variant)
continue
}

Expand All @@ -217,13 +219,13 @@ export const css = (
theme.textShadows[val] as any,
breakpoint
)(theme)
result = { ...result, ...styledTextShadow }
Object.assign(result, styledTextShadow)
continue
}

if (key == 'boxShadow' && val && theme.shadows?.[val]) {
const styledBoxShadow = css(theme.shadows[val] as any, breakpoint)(theme)
result = { ...result, ...styledBoxShadow }
Object.assign(result, styledBoxShadow)
continue
}

Expand All @@ -246,9 +248,9 @@ export const css = (
continue
}

let themedAliases = aliases;
let themedAliases = aliases
if (theme.aliases) {
themedAliases = Object.assign({}, themedAliases, theme.aliases);
themedAliases = Object.assign({}, themedAliases, theme.aliases)
}

const prop =
Expand Down
2 changes: 0 additions & 2 deletions packages/dripsy/src/core/css/scales.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { DripsyFinalTheme } from '../types-v2/declarations'

export const aliases = {
zi: 'zIndex',
dsp: 'display',
Expand Down

0 comments on commit 8e89b4b

Please sign in to comment.