forked from riccardoperra/codeimage
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathStack.tsx
38 lines (35 loc) · 928 Bytes
/
Stack.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import clsx from 'clsx';
import {omitProps} from 'solid-use';
import {Box, BoxProps} from './Box';
import * as styles from './Stack.css';
import {assignInlineVars} from '@vanilla-extract/dynamic';
import {themeVars} from '../../theme';
interface StackProps extends BoxProps {
spacing: keyof typeof themeVars.spacing;
}
export const VStack = (props: StackProps) => {
return (
<Box
{...props}
class={styles.vStack}
style={assignInlineVars({
[styles.stackThemeVars.spacing]: themeVars.spacing[props.spacing],
})}
>
{props.children}
</Box>
);
};
export const HStack = (props: StackProps) => {
return (
<Box
{...omitProps(props, ['class', 'style'])}
class={clsx(styles.hStack, props.class)}
style={assignInlineVars({
[styles.stackThemeVars.spacing]: themeVars.spacing[props.spacing],
})}
>
{props.children}
</Box>
);
};