-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
76 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { style } from '@vanilla-extract/css' | ||
import { tokens, xStack } from 'ui' | ||
|
||
export const detailsListRoot = style({ | ||
listStyle: 'none', | ||
color: tokens.colors.textTranslucentSecondary, | ||
}) | ||
|
||
export const detailsListItem = style([ | ||
xStack({ justifyContent: 'space-between' }), | ||
{ | ||
fontSize: 'inherit', | ||
}, | ||
]) | ||
|
||
export const detailsListLabel = style({ | ||
textAlign: 'start', | ||
}) | ||
|
||
export const detailsListValue = style({ | ||
textAlign: 'end', | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import clsx from 'clsx' | ||
import { type ComponentProps } from 'react' | ||
import { type FontSizeProps, sprinkles } from 'ui' | ||
import { | ||
detailsListItem, | ||
detailsListLabel, | ||
detailsListRoot, | ||
detailsListValue, | ||
} from './DetailsList.css' | ||
|
||
type RootProps = ComponentProps<'ul'> & { | ||
size?: FontSizeProps | ||
} | ||
const DetailsListRoot = ({ size = 'xs', className, children, ...props }: RootProps) => { | ||
return ( | ||
<ul className={clsx(detailsListRoot, sprinkles({ fontSize: size }), className)} {...props}> | ||
{children} | ||
</ul> | ||
) | ||
} | ||
|
||
type ItemProps = ComponentProps<'li'> | ||
const DetailsListItem = ({ className, children, ...props }: ItemProps) => { | ||
return ( | ||
<li className={clsx(className, detailsListItem)} {...props}> | ||
{children} | ||
</li> | ||
) | ||
} | ||
|
||
type LabelProps = ComponentProps<'span'> | ||
const DetailsListLabel = ({ className, children, ...props }: LabelProps) => { | ||
return ( | ||
<span className={clsx(className, detailsListLabel)} {...props}> | ||
{children} | ||
</span> | ||
) | ||
} | ||
|
||
type ValueProps = ComponentProps<'span'> | ||
const DetailsListValue = ({ className, children, ...props }: ValueProps) => { | ||
return ( | ||
<span className={clsx(className, detailsListValue)} {...props}> | ||
{children} | ||
</span> | ||
) | ||
} | ||
|
||
export const DetailsList = { | ||
Root: DetailsListRoot, | ||
Item: DetailsListItem, | ||
Label: DetailsListLabel, | ||
Value: DetailsListValue, | ||
} |