@marigold/system 0.0.2 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +95 -0
- package/dist/Box.d.ts +14 -0
- package/dist/Global.d.ts +2 -0
- package/dist/SVG.d.ts +6 -0
- package/dist/index.d.ts +7 -4
- package/dist/normalize.d.ts +143 -5
- package/dist/system.cjs.development.js +334 -159
- package/dist/system.cjs.development.js.map +1 -1
- package/dist/system.cjs.production.min.js +1 -1
- package/dist/system.cjs.production.min.js.map +1 -1
- package/dist/system.esm.js +324 -156
- package/dist/system.esm.js.map +1 -1
- package/dist/theme.d.ts +136 -0
- package/dist/types.d.ts +8 -0
- package/dist/useTheme.d.ts +15 -5
- package/dist/variant.d.ts +29 -0
- package/package.json +6 -8
- package/src/Box.test.tsx +308 -0
- package/src/Box.tsx +199 -0
- package/src/Colors.stories.mdx +492 -448
- package/src/Global.test.tsx +57 -0
- package/src/Global.tsx +34 -0
- package/src/SVG.stories.mdx +55 -0
- package/src/SVG.test.tsx +82 -0
- package/src/SVG.tsx +24 -0
- package/src/concepts-principles.mdx +1 -1
- package/src/index.ts +7 -4
- package/src/normalize.test.tsx +15 -0
- package/src/normalize.ts +79 -93
- package/src/theme.ts +157 -0
- package/src/types.ts +14 -0
- package/src/useTheme.test.tsx +92 -17
- package/src/useTheme.tsx +45 -6
- package/src/variant.test.ts +93 -0
- package/src/variant.ts +54 -0
- package/dist/categories.d.ts +0 -169
- package/dist/system.d.ts +0 -37
- package/dist/useClassname.d.ts +0 -2
- package/dist/useStyles.d.ts +0 -10
- package/src/categories.ts +0 -203
- package/src/system.test.tsx +0 -84
- package/src/system.tsx +0 -55
- package/src/useClassname.test.tsx +0 -61
- package/src/useClassname.ts +0 -8
- package/src/useStyles.test.tsx +0 -313
- package/src/useStyles.ts +0 -56
- package/src/writeComponent.stories.mdx +0 -126
package/src/categories.ts
DELETED
|
@@ -1,203 +0,0 @@
|
|
|
1
|
-
import { PropertiesFallback } from 'csstype';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* System categories are based on https://primer.style/components/docs/system-props
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
// Spacing
|
|
8
|
-
// ---------------
|
|
9
|
-
export const SPACE_PROPS = [
|
|
10
|
-
'm',
|
|
11
|
-
'margin',
|
|
12
|
-
'mt',
|
|
13
|
-
'marginTop',
|
|
14
|
-
'mr',
|
|
15
|
-
'marginRight',
|
|
16
|
-
'mb',
|
|
17
|
-
'marginBottom',
|
|
18
|
-
'ml',
|
|
19
|
-
'marginLeft',
|
|
20
|
-
'mx',
|
|
21
|
-
'marginX',
|
|
22
|
-
'my',
|
|
23
|
-
'marginY',
|
|
24
|
-
'p',
|
|
25
|
-
'padding',
|
|
26
|
-
'pt',
|
|
27
|
-
'paddingTop',
|
|
28
|
-
'pr',
|
|
29
|
-
'paddingRight',
|
|
30
|
-
'pb',
|
|
31
|
-
'paddingBottom',
|
|
32
|
-
'pl',
|
|
33
|
-
'paddingLeft',
|
|
34
|
-
'px',
|
|
35
|
-
'paddingX',
|
|
36
|
-
'py',
|
|
37
|
-
'paddingY',
|
|
38
|
-
];
|
|
39
|
-
|
|
40
|
-
type StandardCSSProperties = PropertiesFallback<number | string>;
|
|
41
|
-
|
|
42
|
-
export type SpacingProps = {
|
|
43
|
-
/**
|
|
44
|
-
* The **`margin`** CSS property sets the margin area on all four sides of an element. It is a shorthand for `margin-top`, `margin-right`, `margin-bottom`, and `margin-left`.
|
|
45
|
-
*
|
|
46
|
-
* @see https://developer.mozilla.org/docs/Web/CSS/margin
|
|
47
|
-
*/
|
|
48
|
-
m?: StandardCSSProperties['margin'];
|
|
49
|
-
/**
|
|
50
|
-
* The **`margin-top`** CSS property sets the margin area on the top of an element. A positive value places it farther from its neighbors, while a negative value places it closer.
|
|
51
|
-
*
|
|
52
|
-
* **Initial value**: `0`
|
|
53
|
-
*
|
|
54
|
-
* @see https://developer.mozilla.org/docs/Web/CSS/margin-top
|
|
55
|
-
*/
|
|
56
|
-
mt?: StandardCSSProperties['marginTop'];
|
|
57
|
-
/**
|
|
58
|
-
* The **`margin-right`** CSS property sets the margin area on the right side of an element. A positive value places it farther from its neighbors, while a negative value places it closer.
|
|
59
|
-
*
|
|
60
|
-
* **Initial value**: `0`
|
|
61
|
-
*
|
|
62
|
-
* @see https://developer.mozilla.org/docs/Web/CSS/margin-right
|
|
63
|
-
*/
|
|
64
|
-
mr?: StandardCSSProperties['marginRight'];
|
|
65
|
-
/**
|
|
66
|
-
* The **`margin-bottom`** CSS property sets the margin area on the bottom of an element. A positive value places it farther from its neighbors, while a negative value places it closer.
|
|
67
|
-
*
|
|
68
|
-
* **Initial value**: `0`
|
|
69
|
-
*
|
|
70
|
-
* @see https://developer.mozilla.org/docs/Web/CSS/margin-bottom
|
|
71
|
-
*/
|
|
72
|
-
mb?: StandardCSSProperties['marginBottom'];
|
|
73
|
-
/**
|
|
74
|
-
* The **`margin-left`** CSS property sets the margin area on the left side of an element. A positive value places it farther from its neighbors, while a negative value places it closer.
|
|
75
|
-
*
|
|
76
|
-
* **Initial value**: `0`
|
|
77
|
-
*
|
|
78
|
-
* @see https://developer.mozilla.org/docs/Web/CSS/margin-left
|
|
79
|
-
*/
|
|
80
|
-
ml?: StandardCSSProperties['marginLeft'];
|
|
81
|
-
/**
|
|
82
|
-
* The **`mx`** is shorthand for using both **`margin-left`** and **`margin-right`** CSS properties. They set the margin area on the left and right side of an element. A positive value placesit
|
|
83
|
-
* farther from its neighbors, while a negative value places it closer.
|
|
84
|
-
*
|
|
85
|
-
* **Initial value**: `0`
|
|
86
|
-
*
|
|
87
|
-
* @see https://styled-system.com/#margin-props
|
|
88
|
-
* @see https://developer.mozilla.org/docs/Web/CSS/margin-left
|
|
89
|
-
* @see https://developer.mozilla.org/docs/Web/CSS/margin-right
|
|
90
|
-
*/
|
|
91
|
-
mx?: StandardCSSProperties['marginLeft'];
|
|
92
|
-
/**
|
|
93
|
-
* The **`marginX`** is shorthand for using both **`margin-left`** and **`margin-right`** CSS properties. They set the margin area on the left and right side of an element. A positive value
|
|
94
|
-
* places it farther from its neighbors, while a negative value places it closer.
|
|
95
|
-
*
|
|
96
|
-
* **Initial value**: `0`
|
|
97
|
-
*
|
|
98
|
-
* @see https://styled-system.com/#margin-props
|
|
99
|
-
* @see https://developer.mozilla.org/docs/Web/CSS/margin-left
|
|
100
|
-
* @see https://developer.mozilla.org/docs/Web/CSS/margin-right
|
|
101
|
-
*/
|
|
102
|
-
marginX?: StandardCSSProperties['marginLeft'];
|
|
103
|
-
/**
|
|
104
|
-
* The **`my`** is shorthard for using both **`margin-top`** and **`margin-bottom`** CSS properties. They set the margin area on the top and bottom of an element. A positive value places it
|
|
105
|
-
* farther from its neighbors, while a negative value places it closer.
|
|
106
|
-
*
|
|
107
|
-
* **Initial value**: `0`
|
|
108
|
-
*
|
|
109
|
-
* @see https://styled-system.com/#margin-props
|
|
110
|
-
* @see https://developer.mozilla.org/docs/Web/CSS/margin-top
|
|
111
|
-
* @see https://developer.mozilla.org/docs/Web/CSS/margin-bottom
|
|
112
|
-
*/
|
|
113
|
-
my?: StandardCSSProperties['marginTop'];
|
|
114
|
-
/**
|
|
115
|
-
* The **`marginY`** is shorthard for using both **`margin-top`** and **`margin-bottom`** CSS properties. They set the margin area on the top and bottom of an element. A positive value places
|
|
116
|
-
* it farther from its neighbors, while a negative value places it closer.
|
|
117
|
-
*
|
|
118
|
-
* **Initial value**: `0`
|
|
119
|
-
*
|
|
120
|
-
* @see https://styled-system.com/#margin-props
|
|
121
|
-
* @see https://developer.mozilla.org/docs/Web/CSS/margin-top
|
|
122
|
-
* @see https://developer.mozilla.org/docs/Web/CSS/margin-bottom
|
|
123
|
-
*/
|
|
124
|
-
marginY?: StandardCSSProperties['marginTop'];
|
|
125
|
-
/**
|
|
126
|
-
* The **`padding`** CSS property sets the padding area on all four sides of an element. It is a shorthand for `padding-top`, `padding-right`, `padding-bottom`, and `padding-left`.
|
|
127
|
-
*
|
|
128
|
-
* @see https://developer.mozilla.org/docs/Web/CSS/padding
|
|
129
|
-
*/
|
|
130
|
-
p?: StandardCSSProperties['padding'];
|
|
131
|
-
/**
|
|
132
|
-
* The **`padding-top`** padding area on the top of an element.
|
|
133
|
-
*
|
|
134
|
-
* **Initial value**: `0`
|
|
135
|
-
*
|
|
136
|
-
* @see https://developer.mozilla.org/docs/Web/CSS/padding-top
|
|
137
|
-
*/
|
|
138
|
-
pt?: StandardCSSProperties['paddingTop'];
|
|
139
|
-
/**
|
|
140
|
-
* The **`padding-right`** CSS property sets the width of the padding area on the right side of an element.
|
|
141
|
-
*
|
|
142
|
-
* **Initial value**: `0`
|
|
143
|
-
*
|
|
144
|
-
* @see https://developer.mozilla.org/docs/Web/CSS/padding-right
|
|
145
|
-
*/
|
|
146
|
-
pr?: StandardCSSProperties['paddingRight'];
|
|
147
|
-
/**
|
|
148
|
-
* The **`padding-bottom`** CSS property sets the height of the padding area on the bottom of an element.
|
|
149
|
-
*
|
|
150
|
-
* **Initial value**: `0`
|
|
151
|
-
*
|
|
152
|
-
* @see https://developer.mozilla.org/docs/Web/CSS/padding-bottom
|
|
153
|
-
*/
|
|
154
|
-
pb?: StandardCSSProperties['paddingBottom'];
|
|
155
|
-
/**
|
|
156
|
-
* The **`padding-left`** CSS property sets the width of the padding area on the left side of an element.
|
|
157
|
-
*
|
|
158
|
-
* **Initial value**: `0`
|
|
159
|
-
*
|
|
160
|
-
* @see https://developer.mozilla.org/docs/Web/CSS/padding-left
|
|
161
|
-
*/
|
|
162
|
-
pl?: StandardCSSProperties['paddingLeft'];
|
|
163
|
-
/**
|
|
164
|
-
* The **`px`** is shorthand property for CSS properties **`padding-left`** and **`padding-right`**. They set the width of the padding area on the left and right side of an element.
|
|
165
|
-
*
|
|
166
|
-
* **Initial value**: `0`
|
|
167
|
-
*
|
|
168
|
-
* @see https://styled-system.com/#padding-props
|
|
169
|
-
* @see https://developer.mozilla.org/docs/Web/CSS/padding-left
|
|
170
|
-
* @see https://developer.mozilla.org/docs/Web/CSS/padding-right
|
|
171
|
-
*/
|
|
172
|
-
px?: StandardCSSProperties['paddingLeft'];
|
|
173
|
-
/**
|
|
174
|
-
* The **`paddingX`** is shorthand property for CSS properties **`padding-left`** and **`padding-right`**. They set the width of the padding area on the left and right side of an element.
|
|
175
|
-
*
|
|
176
|
-
* **Initial value**: `0`
|
|
177
|
-
*
|
|
178
|
-
* @see https://styled-system.com/#padding-props
|
|
179
|
-
* @see https://developer.mozilla.org/docs/Web/CSS/padding-left
|
|
180
|
-
* @see https://developer.mozilla.org/docs/Web/CSS/padding-right
|
|
181
|
-
*/
|
|
182
|
-
paddingX?: StandardCSSProperties['paddingLeft'];
|
|
183
|
-
/**
|
|
184
|
-
* The **`py`** is shorthand property for CSS properties **`padding-top`** and **`padding-bottom`**. They set the width of the padding area on the top and bottom of an element.
|
|
185
|
-
*
|
|
186
|
-
* **Initial value**: `0`
|
|
187
|
-
*
|
|
188
|
-
* @see https://styled-system.com/#padding-props
|
|
189
|
-
* @see https://developer.mozilla.org/docs/Web/CSS/padding-top
|
|
190
|
-
* @see https://developer.mozilla.org/docs/Web/CSS/padding-bottom
|
|
191
|
-
*/
|
|
192
|
-
py?: StandardCSSProperties['paddingTop'];
|
|
193
|
-
/**
|
|
194
|
-
* The **`paddingY`** is shorthand property for CSS properties **`padding-top`** and **`padding-bottom`**. They set the width of the padding area on the top and bottom of an element.
|
|
195
|
-
*
|
|
196
|
-
* **Initial value**: `0`
|
|
197
|
-
*
|
|
198
|
-
* @see https://styled-system.com/#padding-props
|
|
199
|
-
* @see https://developer.mozilla.org/docs/Web/CSS/padding-top
|
|
200
|
-
* @see https://developer.mozilla.org/docs/Web/CSS/padding-bottom
|
|
201
|
-
*/
|
|
202
|
-
paddingY?: StandardCSSProperties['paddingTop'];
|
|
203
|
-
};
|
package/src/system.test.tsx
DELETED
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { render } from '@testing-library/react';
|
|
3
|
-
import { system } from './system';
|
|
4
|
-
|
|
5
|
-
test('did we break React.forwardRef?', () => {
|
|
6
|
-
const myRef = React.createRef<HTMLElement>();
|
|
7
|
-
const Component = system<{}, 'div'>(props => <div {...props} />);
|
|
8
|
-
render(<Component ref={myRef}>I have a ref!</Component>);
|
|
9
|
-
|
|
10
|
-
expect(myRef.current).toBeInstanceOf(HTMLDivElement);
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* The following tests are not actually testing anything, rather
|
|
15
|
-
* make sure that the typings work as intended.
|
|
16
|
-
*
|
|
17
|
-
* If we mess something up, the typechecking will not work.
|
|
18
|
-
*/
|
|
19
|
-
test('usage with `as` prop', () => {
|
|
20
|
-
type ComponentProps = {
|
|
21
|
-
extra: string;
|
|
22
|
-
children?: React.ReactNode | ((value?: number) => JSX.Element);
|
|
23
|
-
};
|
|
24
|
-
const Component = system<ComponentProps, 'button'>(
|
|
25
|
-
({ as: Comp = 'button', extra, className, children, ...props }) => {
|
|
26
|
-
return (
|
|
27
|
-
<Comp {...props}>
|
|
28
|
-
{typeof children === 'function' ? children(56) : children}
|
|
29
|
-
</Comp>
|
|
30
|
-
);
|
|
31
|
-
}
|
|
32
|
-
);
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* Prop `extra` is required and button attributes allowed.
|
|
36
|
-
*/
|
|
37
|
-
expect(() => {
|
|
38
|
-
render(<Component extra="prop" type="button" />);
|
|
39
|
-
}).not.toThrow();
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* Yay, the `href` attribute is allowed because we're rendering
|
|
43
|
-
* an anchor tag!
|
|
44
|
-
*/
|
|
45
|
-
expect(() => {
|
|
46
|
-
render(<Component as="a" extra="required" href="example.com" />);
|
|
47
|
-
}).not.toThrow();
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* Render another component and adhere to its props. In this case
|
|
51
|
-
* the `to` prop is required by `<Link />`. Also, the `extra` prop
|
|
52
|
-
* from our original component is still required.
|
|
53
|
-
*/
|
|
54
|
-
expect(() => {
|
|
55
|
-
const Link: React.FC<{ to: string; optional?: boolean }> = ({
|
|
56
|
-
to,
|
|
57
|
-
children,
|
|
58
|
-
...props
|
|
59
|
-
}) => (
|
|
60
|
-
<a href={to} {...props}>
|
|
61
|
-
{children}
|
|
62
|
-
</a>
|
|
63
|
-
);
|
|
64
|
-
|
|
65
|
-
render(<Component as={Link} extra="extra" to="adticket.de" />);
|
|
66
|
-
}).not.toThrow();
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
test('usage of the `variant` prop', () => {
|
|
70
|
-
type ComponentProps = {};
|
|
71
|
-
const Component = system<ComponentProps, 'div'>(
|
|
72
|
-
({ as: Comp = 'div', variant = 'basic', children, ...props }) => (
|
|
73
|
-
<Comp {...props} />
|
|
74
|
-
)
|
|
75
|
-
);
|
|
76
|
-
|
|
77
|
-
expect(() => {
|
|
78
|
-
render(<Component />);
|
|
79
|
-
}).not.toThrow();
|
|
80
|
-
|
|
81
|
-
expect(() => {
|
|
82
|
-
render(<Component variant="advanced" />);
|
|
83
|
-
}).not.toThrow();
|
|
84
|
-
});
|
package/src/system.tsx
DELETED
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Typings are based on [Reach UI](https://github.com/reach/reach-ui/blob/4cb497f530b0f83f80c6f6f2da46ab55b1160cb6/packages/utils/src/types.tsx).
|
|
3
|
-
*/
|
|
4
|
-
import {
|
|
5
|
-
forwardRef,
|
|
6
|
-
ComponentPropsWithRef,
|
|
7
|
-
ElementType,
|
|
8
|
-
ReactElement,
|
|
9
|
-
ValidationMap,
|
|
10
|
-
WeakValidationMap,
|
|
11
|
-
} from 'react';
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* SystemProps support the `as` and `variant` prop. The former
|
|
15
|
-
* is used to changed the rendered root element of a component.
|
|
16
|
-
*
|
|
17
|
-
* These props also infer additional allowed props based on the
|
|
18
|
-
* value of the `as` prop. For example, setting `as="button"` will
|
|
19
|
-
* allow to use HTMLButtonAttributes on the component.
|
|
20
|
-
*/
|
|
21
|
-
export type SystemProps<P, T extends ElementType> = P &
|
|
22
|
-
Omit<ComponentPropsWithRef<T>, 'as' | keyof P> & {
|
|
23
|
-
as?: T;
|
|
24
|
-
variant?: string;
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* Enhanced version of `React.FunctionComponent` that accepts `SystemProps`
|
|
29
|
-
* and infers allowed properties based on the `as` prop.
|
|
30
|
-
*/
|
|
31
|
-
export interface SystemComponent<P, T extends ElementType> {
|
|
32
|
-
/**
|
|
33
|
-
* These types are a bit of a hack, but cover us in cases where the `as` prop
|
|
34
|
-
* is not a JSX string type. Makes the compiler happy so 🤷♂️
|
|
35
|
-
*/
|
|
36
|
-
<TT extends ElementType>(props: SystemProps<P, TT>): ReactElement | null;
|
|
37
|
-
(props: SystemProps<P, T>): ReactElement | null;
|
|
38
|
-
|
|
39
|
-
displayName?: string;
|
|
40
|
-
propTypes?: WeakValidationMap<SystemProps<P, T>>;
|
|
41
|
-
contextTypes?: ValidationMap<any>;
|
|
42
|
-
defaultProps?: Partial<SystemProps<P, T>>;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* Helper to write components that adhere to a common design system API,
|
|
47
|
-
* which includes the `as` and `variant` prop.
|
|
48
|
-
*/
|
|
49
|
-
export function system<P, T extends ElementType>(
|
|
50
|
-
render: (props: SystemProps<P, T>) => ReactElement | null
|
|
51
|
-
) {
|
|
52
|
-
return forwardRef((props: any, ref) =>
|
|
53
|
-
render({ ...props, ref })
|
|
54
|
-
) as SystemComponent<P, T>;
|
|
55
|
-
}
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { renderHook } from '@testing-library/react-hooks';
|
|
3
|
-
import { useClassname } from './useClassname';
|
|
4
|
-
import { ThemeProvider } from './useTheme';
|
|
5
|
-
|
|
6
|
-
// Setup
|
|
7
|
-
// ---------------
|
|
8
|
-
const theme = {
|
|
9
|
-
colors: {
|
|
10
|
-
primary: 'hotpink',
|
|
11
|
-
black: '#000',
|
|
12
|
-
},
|
|
13
|
-
sizes: [0, 1, 2],
|
|
14
|
-
text: {
|
|
15
|
-
body: {
|
|
16
|
-
fontSize: 1,
|
|
17
|
-
color: 'black',
|
|
18
|
-
},
|
|
19
|
-
heading: {
|
|
20
|
-
fontSize: 3,
|
|
21
|
-
color: 'primary',
|
|
22
|
-
},
|
|
23
|
-
},
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
const wrapper: React.FC = ({ children }) => (
|
|
27
|
-
<ThemeProvider theme={theme}>{children}</ThemeProvider>
|
|
28
|
-
);
|
|
29
|
-
|
|
30
|
-
test('create a string classname', () => {
|
|
31
|
-
const { result } = renderHook(() => useClassname({ color: 'primary' }), {
|
|
32
|
-
wrapper,
|
|
33
|
-
});
|
|
34
|
-
expect(result.current).toEqual(expect.any(String));
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
test('create classnames from multiple intpus', () => {
|
|
38
|
-
const { result } = renderHook(
|
|
39
|
-
() => useClassname({ color: 'primary' }, { p: 2 }),
|
|
40
|
-
{
|
|
41
|
-
wrapper,
|
|
42
|
-
}
|
|
43
|
-
);
|
|
44
|
-
expect(result.current).toEqual(expect.any(String));
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
test('create a unique classnames', () => {
|
|
48
|
-
const { result: first } = renderHook(
|
|
49
|
-
() => useClassname({ color: 'primary' }),
|
|
50
|
-
{
|
|
51
|
-
wrapper,
|
|
52
|
-
}
|
|
53
|
-
);
|
|
54
|
-
const { result: second } = renderHook(
|
|
55
|
-
() => useClassname({ color: 'black' }),
|
|
56
|
-
{
|
|
57
|
-
wrapper,
|
|
58
|
-
}
|
|
59
|
-
);
|
|
60
|
-
expect(first.current).not.toEqual(second.current);
|
|
61
|
-
});
|
package/src/useClassname.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { css as emotion } from 'emotion';
|
|
2
|
-
import { css, ThemeUIStyleObject } from '@theme-ui/css';
|
|
3
|
-
import { useTheme } from './useTheme';
|
|
4
|
-
|
|
5
|
-
export const useClassname = (...styles: ThemeUIStyleObject[]) => {
|
|
6
|
-
const theme = useTheme();
|
|
7
|
-
return styles.map(style => emotion(css(style)(theme))).join(' ');
|
|
8
|
-
};
|