Skip to content

Commit

Permalink
feat(react-components): Add DropdownMenu component (#200)
Browse files Browse the repository at this point in the history
Add `DropdownMenu` component
  • Loading branch information
insmac authored Sep 21, 2023
1 parent 5e03f5b commit 2ae08a6
Show file tree
Hide file tree
Showing 34 changed files with 1,254 additions and 0 deletions.
688 changes: 688 additions & 0 deletions .pnp.cjs

Large diffs are not rendered by default.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
1 change: 1 addition & 0 deletions packages/react-components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
"dependencies": {
"@radix-ui/react-alert-dialog": "^1.0.3",
"@radix-ui/react-dialog": "^1.0.3",
"@radix-ui/react-dropdown-menu": "^2.0.5",
"@radix-ui/react-switch": "^1.0.2",
"joi": "^17.9.2"
}
Expand Down
51 changes: 51 additions & 0 deletions packages/react-components/src/components/DropdownMenu/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import * as RadixDropdownMenu from "@radix-ui/react-dropdown-menu";
import styled from "styled-components";

export const DropdownMenu = {
Root: RadixDropdownMenu.Root,

Trigger: styled(RadixDropdownMenu.Trigger)`
cursor: pointer;
`,

Content: styled(RadixDropdownMenu.Content)`
display: grid;
gap: 0.5rem;
min-width: 22rem;
background: ${({ theme }) => theme.color.backgroundLighter};
border-radius: ${({ theme }) => theme.borderRadius};
box-shadow: 0 5px 5px 0 ${({ theme }) => theme.color.black40};
padding: 1rem 0;
`,

Arrow: styled(RadixDropdownMenu.Arrow)`
fill: ${({ theme }) => theme.color.black40};
`,

Item: styled(RadixDropdownMenu.Item)`
border-radius: 3px;
display: flex;
gap: 1.5rem;
align-items: center;
padding: 0.5rem 1rem;
margin: 0 0.5rem;
user-select: none;
outline: none;
&[data-disabled] {
pointer-events: none;
opacity: 0.8;
}
&:focus {
background: ${({ theme }) => theme.color.comment};
cursor: pointer;
}
`,

Divider: styled.div`
height: 1px;
background: ${({ theme }) => theme.color.selection};
margin: 0.5rem 0;
`,
};
1 change: 1 addition & 0 deletions packages/react-components/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ export { Button } from "./components/Button";
export { Card } from "./components/Card";
export { Checkbox } from "./components/Checkbox";
export { Dialog } from "./components/Dialog";
export { DropdownMenu } from "./components/DropdownMenu";
export { FeedbackDialog } from "./components/FeedbackDialog";
export { ForwardRef } from "./components/ForwardRef";
export { Heading } from "./components/Heading";
Expand Down
Loading

0 comments on commit 2ae08a6

Please sign in to comment.