-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feat(web-react): Introduce
alignment
to Dropdown
component #DS-1411
- Loading branch information
Showing
8 changed files
with
236 additions
and
32 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
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
35 changes: 35 additions & 0 deletions
35
packages/web-react/src/components/Dropdown/demo/DropdownAlignment.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,35 @@ | ||
import React from 'react'; | ||
import { Button } from '../../Button'; | ||
import { Grid } from '../../Grid'; | ||
import { Item } from '../../Item'; | ||
import Dropdown from '../Dropdown'; | ||
import DropdownPopover from '../DropdownPopover'; | ||
import DropdownTrigger from '../DropdownTrigger'; | ||
|
||
const DropdownAlignment = () => { | ||
const [isOpen, setIsOpen] = React.useState(false); | ||
const onToggle = () => setIsOpen(!isOpen); | ||
|
||
return ( | ||
<Grid cols={2}> | ||
<Dropdown | ||
alignmentX={{ mobile: 'right', tablet: 'left', desktop: 'center' }} | ||
alignmentY="center" | ||
id="dropdown-alignment" | ||
isOpen={isOpen} | ||
onToggle={onToggle} | ||
placement="top-start" | ||
> | ||
<DropdownTrigger elementType={Button}>Button as anchor</DropdownTrigger> | ||
<DropdownPopover> | ||
<Item elementType="a" href="#" label="Action" /> | ||
<Item elementType="a" href="#" label="Another action" /> | ||
<Item elementType="a" href="#" label="Something else here" /> | ||
</DropdownPopover> | ||
</Dropdown> | ||
<div className="px-800 py-1700 bg-tertiary text-center">This a big unrelated box</div> | ||
</Grid> | ||
); | ||
}; | ||
|
||
export default DropdownAlignment; |
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
Oops, something went wrong.