This repository was archived by the owner on Dec 21, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 11 files changed +122
-34
lines changed
Expand file tree Collapse file tree 11 files changed +122
-34
lines changed Original file line number Diff line number Diff line change 11---
22name : Feature request
33about : Suggest a feature for this project
4- title : " ✨ "
4+ title : ' ✨ '
55labels : enhancement
66assignees : ' '
7-
87---
98
109** Is your feature request related to a problem? Please describe.**
Original file line number Diff line number Diff line change 3535 },
3636 "dependencies" : {
3737 "@radix-ui/react-checkbox" : " ^1.0.1" ,
38+ "@radix-ui/react-separator" : " ^1.0.1" ,
3839 "@vanilla-extract/css" : " ^1.6.3" ,
3940 "@vanilla-extract/css-utils" : " ^0.1.1" ,
4041 "@vanilla-extract/dynamic" : " ^2.0.0" ,
Original file line number Diff line number Diff line change @@ -68,38 +68,6 @@ const tone = {
6868
6969export type Tone = keyof typeof tone
7070
71- export const checkbox = style ( {
72- all : 'unset' ,
73- backgroundColor : vars . colors . background ,
74- width : vars . space [ '10' ] ,
75- height : vars . space [ '10' ] ,
76- borderRadius : vars . radii . large ,
77- display : 'flex' ,
78- alignItems : 'center' ,
79- justifyContent : 'center' ,
80- boxShadow : `0 0 0 1px ${ vars . colors . foregroundSecondary } ` ,
81-
82- selectors : {
83- '&[data-state="checked"]' : {
84- backgroundColor : vars . colors . green ,
85- } ,
86- '&[data-disabled]' : {
87- backgroundColor : vars . colors . foregroundSecondary ,
88- } ,
89- } ,
90-
91- ':hover' : {
92- backgroundColor : vars . colors . background ,
93- } ,
94- ':focus' : {
95- boxShadow : `0 0 0 2px ${ vars . colors . foregroundSecondary } ` ,
96- } ,
97- } )
98-
99- export const indicator = style ( {
100- color : vars . colors . accent ,
101- } )
102-
10371const variant = {
10472 primary : style ( [
10573 atoms ( {
Original file line number Diff line number Diff line change 1+ ---
2+ title : Divider
3+ description : Visually or semantically separates content.
4+ ---
5+
6+ ``` tsx
7+ import { Divider } from ' @kalidao/reality'
8+ ```
9+
10+ ``` tsx live=true expand=true
11+ <Divider />
12+ ```
13+
14+ ## Props
15+
16+ <PropsTable sourceLink = { sourceLink } types = { types } />
Original file line number Diff line number Diff line change 1+ import * as React from 'react'
2+
3+ import { Snippet } from '!/playroom/src/types'
4+ import { Divider } from './Divider'
5+
6+ export const snippets : Snippet [ ] = [
7+ {
8+ name : 'Basic' ,
9+ code : < Divider /> ,
10+ } ,
11+ ]
Original file line number Diff line number Diff line change 1+ import * as React from 'react'
2+
3+ import { cleanup , render } from '@/test'
4+
5+ import { Divider } from './Divider'
6+
7+ describe ( '<Divider />' , ( ) => {
8+ afterEach ( cleanup )
9+
10+ it ( 'renders' , ( ) => {
11+ render ( < Divider /> )
12+ } )
13+ } )
Original file line number Diff line number Diff line change 1+ import * as React from 'react'
2+ import * as Separator from '@radix-ui/react-separator'
3+
4+ import { Stack } from '../Stack'
5+ import { Text } from '../Text'
6+ import * as styles from './styles.css'
7+
8+ type Props = {
9+ label ?: string
10+ orientation ?: 'horizontal' | 'vertical'
11+ }
12+
13+ export const Divider = ( { label, orientation = 'horizontal' } : Props ) => {
14+ if ( ! label )
15+ return (
16+ < Separator . Root
17+ className = { styles . variants ( {
18+ orientation,
19+ } ) }
20+ orientation = { orientation }
21+ />
22+ )
23+
24+ return (
25+ < Stack align = "center" direction = { orientation } >
26+ < Separator . Root
27+ className = { styles . variants ( {
28+ orientation,
29+ } ) }
30+ orientation = { orientation }
31+ />
32+ < Text > { label } </ Text >
33+ < Separator . Root className = { styles . variants ( ) } orientation = { orientation } />
34+ </ Stack >
35+ )
36+ }
37+
38+ Divider . displayName = 'Divider'
Original file line number Diff line number Diff line change 1+ export { Divider } from './Divider'
Original file line number Diff line number Diff line change 1+ import { RecipeVariants , recipe } from '@vanilla-extract/recipes'
2+ import { style } from '@vanilla-extract/css'
3+
4+ import { vars } from '../../css'
5+
6+ export const variants = recipe ( {
7+ base : style ( [
8+ style ( {
9+ backgroundColor : vars . colors . foregroundSecondary ,
10+ } ) ,
11+ ] ) ,
12+ variants : {
13+ orientation : {
14+ vertical : {
15+ height : '100%' ,
16+ width : '1px' ,
17+ } ,
18+ horizontal : {
19+ height : '1px' ,
20+ width : '100%' ,
21+ } ,
22+ } ,
23+ } ,
24+ } )
25+
26+ export type Variants = RecipeVariants < typeof variants >
Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ export { Button } from './Button'
77export { ButtonCard } from './ButtonCard'
88export { Card } from './Card'
99export { Checkbox } from './Checkbox'
10+ export { Divider } from './Divider'
1011export { Field } from './Field'
1112export { FieldSet } from './FieldSet'
1213export { FileInput } from './FileInput'
You can’t perform that action at this time.
0 commit comments