forked from sheepzh/time-tracker-4-browser
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGrid.tsx
More file actions
29 lines (25 loc) · 862 Bytes
/
Grid.tsx
File metadata and controls
29 lines (25 loc) · 862 Bytes
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
import { CSSProperties, defineComponent, h, useSlots } from 'vue'
import { ALL_BASE_PROPS, cvt2BaseStyle, cvtPxScale, type BaseProps } from './common'
type Props = {
gap?: string | number
templateColumns?: CSSProperties['gridTemplateColumns']
} & BaseProps
const Grid = defineComponent<Props>(props => {
const { default: defaultSlots } = useSlots()
return () => (
<div
id={props.id}
class={props.class}
onClick={props.onClick}
style={{
display: 'grid',
gap: cvtPxScale(props.gap),
gridTemplateColumns: props.templateColumns,
...cvt2BaseStyle(props),
}}
>
{defaultSlots && h(defaultSlots)}
</div>
)
}, { props: [...ALL_BASE_PROPS, 'gap', 'templateColumns'] })
export default Grid