-
-
Notifications
You must be signed in to change notification settings - Fork 127
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
8 changed files
with
95 additions
and
124 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
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,52 @@ | ||
import { style, globalStyle } from '@vanilla-extract/css'; | ||
import { calc } from '@vanilla-extract/css-utils'; | ||
import { contract } from '../ThemeProvider/themes/contract.css'; | ||
|
||
import rightcaret from '../GlobalStyle/imgs/rightcaret.svg'; | ||
|
||
export const listItem = style({ | ||
position: 'relative', | ||
display: 'flex', | ||
alignItems: 'center', | ||
margin: contract.space[0], | ||
paddingBlock: contract.space[2], | ||
paddingInline: contract.space[6], | ||
color: contract.colors.materialText, | ||
selectors: { | ||
'&:hover': { | ||
backgroundColor: contract.colors.headerBackground, | ||
color: contract.colors.materialTextInvert, | ||
}, | ||
}, | ||
}); | ||
|
||
globalStyle(`${listItem} svg`, { marginRight: contract.space[10] }); | ||
globalStyle(`${listItem} ul`, { | ||
display: 'none', | ||
position: 'absolute', | ||
top: calc.negate(contract.space[2]), | ||
left: '97%', | ||
color: contract.colors.materialText, | ||
zIndex: contract.zIndices.taskbar, | ||
}); | ||
|
||
export const divider = style({ | ||
height: contract.space[1], | ||
borderTopStyle: 'solid', | ||
borderTopWidth: contract.space[1], | ||
borderTopColor: contract.colors.borderDark, | ||
borderBottomWidth: contract.space[1], | ||
borderBottomStyle: 'solid', | ||
borderBottomColor: contract.colors.borderLightest, | ||
width: '98%', | ||
marginLeft: contract.space[2], | ||
}); | ||
|
||
export const list = style({ | ||
backgroundColor: contract.colors.material, | ||
padding: contract.space[2], | ||
border: 'none', | ||
margin: 0, | ||
listStyle: 'none', | ||
boxShadow: contract.shadows.out, | ||
}); |
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 |
---|---|---|
@@ -1,44 +1,24 @@ | ||
import styled, { th } from '@xstyled/styled-components'; | ||
|
||
import ListItem from './ListItem'; | ||
import Divider from './ListDivider'; | ||
|
||
type ListProps = { | ||
width?: number; | ||
}; | ||
|
||
const StyledList = styled.ul<ListProps>` | ||
background-color: material; | ||
padding: 5 20 6; | ||
border: none; | ||
margin: 0; | ||
padding: 2; | ||
list-style: none; | ||
import { Divider } from './ListDivider'; | ||
import { Frame, FrameProps } from '../Frame/Frame'; | ||
import React from 'react'; | ||
import { list } from './List.css'; | ||
import cn from 'classnames'; | ||
|
||
box-shadow: inset 1px 1px 0px 1px ${th('colors.borderLightest')}, | ||
inset 0 0 0 1px ${th('colors.borderDark')}, | ||
1px 1px 0 1px ${th('colors.borderDarkest')}; | ||
export type ListProps = Omit<FrameProps<'ul'>, 'as'>; | ||
|
||
${({ width }) => ` | ||
width: ${width}px; | ||
`}; | ||
`; | ||
const ListRenderer = React.forwardRef<HTMLUListElement, ListProps>( | ||
(rest, ref) => ( | ||
<Frame {...rest} ref={ref} className={cn(list, rest.className)} as="ul" /> | ||
), | ||
); | ||
|
||
export type IListProps = typeof StyledList & { | ||
export type IListProps = typeof ListRenderer & { | ||
Item: typeof ListItem; | ||
Divider: typeof Divider; | ||
}; | ||
|
||
const List: IListProps = Object.assign(StyledList, { | ||
export const List: IListProps = Object.assign(ListRenderer, { | ||
Item: ListItem, | ||
Divider: Divider, | ||
}); | ||
|
||
List.displayName = 'List'; | ||
|
||
List.defaultProps = { | ||
width: 200, | ||
}; | ||
|
||
export default List; |
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 |
---|---|---|
@@ -1,16 +1,19 @@ | ||
import styled from '@xstyled/styled-components'; | ||
import React from 'react'; | ||
import { Frame, FrameProps } from '../Frame/Frame'; | ||
import { divider } from './List.css'; | ||
import cn from 'classnames'; | ||
|
||
const Divider = styled.li` | ||
height: 1px; | ||
border-top: 1; | ||
border-top-color: borderDark; | ||
border-bottom: 1; | ||
border-bottom-color: borderLightest; | ||
export type DividerProps = Omit<FrameProps<'li'>, 'as'>; | ||
|
||
width: 98%; | ||
margin-left: 2; | ||
`; | ||
export const Divider = React.forwardRef<HTMLLIElement, DividerProps>( | ||
(rest, ref) => ( | ||
<Frame | ||
{...rest} | ||
ref={ref} | ||
className={cn(divider, rest.className)} | ||
as="li" | ||
/> | ||
), | ||
); | ||
|
||
Divider.displayName = 'List.Divider'; | ||
|
||
export default Divider; |
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
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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
import List from './List'; | ||
import { List } from './List'; | ||
|
||
export default List; |
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
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