-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #549 from pixiv/toshusai/dropdown-selector-change-…
…styled-to-css feat: dropdown selector v4 styled to css
- Loading branch information
Showing
24 changed files
with
916 additions
and
2,146 deletions.
There are no files selected for viewing
16 changes: 0 additions & 16 deletions
16
packages/react/src/components/DropdownSelector/Divider.tsx
This file was deleted.
Oops, something went wrong.
11 changes: 11 additions & 0 deletions
11
packages/react/src/components/DropdownSelector/Divider/index.css
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,11 @@ | ||
.charcoal-menu-group-divider { | ||
display: flex; | ||
} | ||
|
||
.charcoal-menu-group-divider::before { | ||
content: ''; | ||
display: block; | ||
width: 100%; | ||
height: 1px; | ||
background: #00000014; | ||
} |
5 changes: 5 additions & 0 deletions
5
packages/react/src/components/DropdownSelector/Divider/index.tsx
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,5 @@ | ||
import './index.css' | ||
|
||
export function Divider() { | ||
return <div role="separator" className="charcoal-menu-group-divider" /> | ||
} |
43 changes: 0 additions & 43 deletions
43
packages/react/src/components/DropdownSelector/DropdownMenuItem.tsx
This file was deleted.
Oops, something went wrong.
20 changes: 20 additions & 0 deletions
20
packages/react/src/components/DropdownSelector/DropdownMenuItem/index.css
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,20 @@ | ||
.charcoal-dropdown-selector-menu-item { | ||
font-size: 14px; | ||
line-height: 22px; | ||
color: var(--charcoal-text2); | ||
padding: 9px 0; | ||
|
||
display: flex; | ||
align-items: center; | ||
width: 100%; | ||
margin-left: 20px; | ||
} | ||
|
||
.charcoal-dropdown-selector-menu-item[data-selected='true'] { | ||
margin-left: 0px; | ||
} | ||
|
||
.charcoal-dropdown-selector-menu-item-icon { | ||
color: var(--charcoal-text2); | ||
padding-right: 4px; | ||
} |
34 changes: 34 additions & 0 deletions
34
packages/react/src/components/DropdownSelector/DropdownMenuItem/index.tsx
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,34 @@ | ||
import './index.css' | ||
|
||
import MenuItem, { MenuItemProps } from '../MenuItem' | ||
import { MenuListContext } from '../MenuList/MenuListContext' | ||
import { useContext } from 'react' | ||
import Icon from '../../Icon' | ||
|
||
export type DropdownMenuItemProps = Omit<MenuItemProps, 'as'> | ||
|
||
/** | ||
* DropdownSelectorの選択肢として使うMenuItem | ||
*/ | ||
export default function DropdownMenuItem(props: DropdownMenuItemProps) { | ||
const { value: ctxValue } = useContext(MenuListContext) | ||
const isSelected = props.value === ctxValue | ||
const { children, ...rest } = props | ||
|
||
return ( | ||
<MenuItem {...rest} aria-selected={isSelected}> | ||
{isSelected && ( | ||
<Icon | ||
className="charcoal-dropdown-selector-menu-item-icon" | ||
name="16/Check" | ||
/> | ||
)} | ||
<span | ||
className="charcoal-dropdown-selector-menu-item" | ||
data-selected={isSelected} | ||
> | ||
{props.children} | ||
</span> | ||
</MenuItem> | ||
) | ||
} |
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
24 changes: 24 additions & 0 deletions
24
packages/react/src/components/DropdownSelector/ListItem/index.css
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,24 @@ | ||
.charcoal-list-item { | ||
list-style: none; | ||
display: flex; | ||
align-items: center; | ||
min-height: 40px; | ||
cursor: pointer; | ||
outline: none; | ||
|
||
padding-right: 16px; | ||
padding-left: 16px; | ||
|
||
transition: background-color 0.2s; | ||
} | ||
|
||
.charcoal-list-item:not([aria-disabled='true']):hover, | ||
.charcoal-list-item:not([aria-disabled='true']):focus, | ||
.charcoal-list-item:not([aria-disabled='true']):focus-within { | ||
background-color: var(--charcoal-surface3); | ||
} | ||
|
||
.charcoal-list-item[aria-disabled='true'] { | ||
opacity: 0.32; | ||
cursor: default; | ||
} |
Oops, something went wrong.