-
Notifications
You must be signed in to change notification settings - Fork 2
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
1 parent
a62e412
commit 0f36ce8
Showing
33 changed files
with
252 additions
and
342 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
97 changes: 33 additions & 64 deletions
97
packages/components/src/ComboBox/docs/ComboBoxOption/dynamicLists.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 |
---|---|---|
@@ -1,71 +1,40 @@ | ||
import { Collection, ComboBox, ComboBoxItem, ComboBoxSection, Header, Inline } from "@hopper-ui/components"; | ||
import { Collection, ComboBox, ComboBoxItem, ComboBoxSection, Header } from "@hopper-ui/components"; | ||
|
||
interface ListItemProps { | ||
id: number | string; | ||
role: string; | ||
} | ||
|
||
interface ListSectionProps { | ||
role: string; | ||
children: ListItemProps[]; | ||
} | ||
const OPTIONS_WITH_SECTIONS = [ | ||
{ | ||
role: "Operations", children: [ | ||
{ id: 2, role: "Project Coordinator" }, | ||
{ id: 3, role: "QA Specialist" }, | ||
{ id: 4, role: "System Administrator" } | ||
] | ||
}, | ||
{ | ||
role: "Creative Department", children: [ | ||
{ id: 6, role: "Designer" }, | ||
{ id: 7, role: "Designer" }, | ||
{ id: 8, role: "UX Researcher" } | ||
] | ||
} | ||
]; | ||
|
||
export default function Example() { | ||
const options = [ | ||
{ id: 2, role: "Designer" }, | ||
{ id: 3, role: "Developer" }, | ||
{ id: 4, role: "Manager" }, | ||
{ id: 6, role: "QA Engineer" }, | ||
{ id: 7, role: "Product Owner" }, | ||
{ id: 8, role: "Scrum Master" } | ||
] satisfies ListItemProps[]; | ||
|
||
const optionsWithSections = [ | ||
{ | ||
role: "Operations", children: [ | ||
{ id: 2, role: "Project Coordinator" }, | ||
{ id: 3, role: "QA Specialist" }, | ||
{ id: 4, role: "System Administrator" } | ||
] | ||
}, | ||
{ | ||
role: "Creative Department", children: [ | ||
{ id: 6, role: "Designer" }, | ||
{ id: 7, role: "Designer" }, | ||
{ id: 8, role: "UX Researcher" } | ||
] | ||
} | ||
] satisfies ListSectionProps[]; | ||
|
||
return ( | ||
<Inline alignY="flex-start"> | ||
<ComboBox | ||
items={options} | ||
label="Items" | ||
> | ||
{(item: ListItemProps) => { | ||
const { id, role } = item; | ||
|
||
return <ComboBoxItem id={id}>{role}</ComboBoxItem>; | ||
}} | ||
</ComboBox> | ||
<ComboBox | ||
items={optionsWithSections} | ||
label="Section" | ||
> | ||
{(section: ListSectionProps) => { | ||
const { role: sectionName, children } = section; | ||
<ComboBox | ||
items={OPTIONS_WITH_SECTIONS} | ||
label="Section" | ||
> | ||
{section => { | ||
const { role: sectionName, children } = section; | ||
|
||
return ( | ||
<ComboBoxSection id={sectionName}> | ||
<Header>{sectionName}</Header> | ||
<Collection items={children}> | ||
{item => <ComboBoxItem id={item.id}>{item.role}</ComboBoxItem>} | ||
</Collection> | ||
</ComboBoxSection> | ||
); | ||
}} | ||
</ComboBox> | ||
</Inline> | ||
return ( | ||
<ComboBoxSection id={sectionName}> | ||
<Header>{sectionName}</Header> | ||
<Collection items={children}> | ||
{item => <ComboBoxItem id={item.id}>{item.role}</ComboBoxItem>} | ||
</Collection> | ||
</ComboBoxSection> | ||
); | ||
}} | ||
</ComboBox> | ||
); | ||
} |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,22 @@ | ||
import { Disclosure, DisclosureHeader, DisclosurePanel, Div } from "@hopper-ui/components"; | ||
import { Disclosure, DisclosureHeader, DisclosurePanel } from "@hopper-ui/components"; | ||
import { useState } from "react"; | ||
|
||
export default function Example() { | ||
const [isExpanded, setIsExpanded] = useState(true); | ||
|
||
return ( | ||
<Div width="100%" paddingX="core_320" paddingY="core_480"> | ||
<Disclosure | ||
isExpanded={isExpanded} | ||
onExpandedChange={setIsExpanded} | ||
> | ||
<DisclosureHeader> | ||
This disclosure is {isExpanded ? "expanded" : "collapsed"} | ||
</DisclosureHeader> | ||
<DisclosurePanel> | ||
Tackle the challenges of hybrid, remote and distributed work, no matter what. | ||
The Workleap platform builds solutions tailored to your existing HR and productivity tools to answer these challenges. | ||
</DisclosurePanel> | ||
</Disclosure> | ||
</Div> | ||
<Disclosure | ||
width="100%" | ||
isExpanded={isExpanded} | ||
onExpandedChange={setIsExpanded} | ||
> | ||
<DisclosureHeader> | ||
This disclosure is {isExpanded ? "expanded" : "collapsed"} | ||
</DisclosureHeader> | ||
<DisclosurePanel> | ||
Tackle the challenges of hybrid, remote and distributed work, no matter what. | ||
The Workleap platform builds solutions tailored to your existing HR and productivity tools to answer these challenges. | ||
</DisclosurePanel> | ||
</Disclosure> | ||
); | ||
} | ||
} |
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,22 +1,18 @@ | ||
import { Button, Disclosure, DisclosurePanel, Div, Text } from "@hopper-ui/components"; | ||
import { Button, Disclosure, DisclosurePanel, Text } from "@hopper-ui/components"; | ||
|
||
import { ToggleArrow } from "../../ToggleArrow/index.ts"; | ||
|
||
export default function Example() { | ||
return ( | ||
<Div width="100%" paddingX="core_320" paddingY="core_480"> | ||
<Disclosure> | ||
<Button slot="trigger" variant="secondary"> | ||
<Text>Help your people work better</Text> | ||
<ToggleArrow | ||
slot="end-icon" | ||
/> | ||
</Button> | ||
<DisclosurePanel> | ||
Tackle the challenges of hybrid, remote and distributed work, no matter what. | ||
The Workleap platform builds solutions tailored to your existing HR and productivity tools to answer these challenges. | ||
</DisclosurePanel> | ||
</Disclosure> | ||
</Div> | ||
<Disclosure width="100%"> | ||
<Button slot="trigger" variant="secondary"> | ||
<Text>Help your people work better</Text> | ||
<ToggleArrow slot="end-icon" /> | ||
</Button> | ||
<DisclosurePanel> | ||
Tackle the challenges of hybrid, remote and distributed work, no matter what. | ||
The Workleap platform builds solutions tailored to your existing HR and productivity tools to answer these challenges. | ||
</DisclosurePanel> | ||
</Disclosure> | ||
); | ||
} | ||
} |
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,20 +1,18 @@ | ||
import { Disclosure, DisclosureHeader, DisclosurePanel, Div, Inline, Text } from "@hopper-ui/components"; | ||
import { Disclosure, DisclosureHeader, DisclosurePanel, Inline, Text } from "@hopper-ui/components"; | ||
|
||
export default function Example() { | ||
return ( | ||
<Div width="100%" paddingX="core_320" paddingY="core_480"> | ||
<Disclosure> | ||
<DisclosureHeader> | ||
<Inline columnGap="inline-sm" rowGap="core_0" alignY="baseline"> | ||
<Text>Workleap Officevibe</Text> | ||
<Text color="neutral-weak" size="sm">Engagement and Feedback</Text> | ||
</Inline> | ||
</DisclosureHeader> | ||
<DisclosurePanel> | ||
Help employees speak up and make sure they feel heard. | ||
Continuous and real-time surveys offer feedback to celebrate every win, recognize commitment, and uncover challenges. | ||
</DisclosurePanel> | ||
</Disclosure> | ||
</Div> | ||
<Disclosure width="100%"> | ||
<DisclosureHeader> | ||
<Inline columnGap="inline-sm" rowGap="core_0" alignY="baseline"> | ||
<Text>Workleap Officevibe</Text> | ||
<Text color="neutral-weak" size="sm">Engagement and Feedback</Text> | ||
</Inline> | ||
</DisclosureHeader> | ||
<DisclosurePanel> | ||
Help employees speak up and make sure they feel heard. | ||
Continuous and real-time surveys offer feedback to celebrate every win, recognize commitment, and uncover challenges. | ||
</DisclosurePanel> | ||
</Disclosure> | ||
); | ||
} | ||
} |
Oops, something went wrong.