-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[DST-518]: Revise "menu" Page (#4124)
* Adding anatomy section * Adding anatomy slots * adding appearance example * Adding usage section * Adding dos * revise examples * revise section example * Revising more examples * Adding changeset * enhance description * Resolving comments * remove unwanted description * Resolving comments * Edit image * Edit image * Edit anatomy * Change order * Edit anatomy image * Resolving comments * enhance menu section usage example "Adding more description" * Edit anatomy picture * make the anatomy pic bigger * Enhance multiselect example * Adding more sections * Add more explanation for meni item opens dialog section example * Fixing typo
- Loading branch information
1 parent
7d2118b
commit 7c38527
Showing
9 changed files
with
197 additions
and
52 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@marigold/docs': patch | ||
--- | ||
|
||
[DST-518]: Revise "Menu" Page |
78 changes: 78 additions & 0 deletions
78
docs/content/components/overlay/menu/menu-action-table.demo.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,78 @@ | ||
import { useState } from 'react'; | ||
import { ActionMenu, Menu, Table } from '@marigold/components'; | ||
|
||
const rows = [ | ||
{ | ||
ticketId: 'TCK-001', | ||
eventName: 'Champions League Final', | ||
status: 'Confirmed', | ||
}, | ||
{ | ||
ticketId: 'TCK-002', | ||
eventName: 'Rock Concert', | ||
status: 'Pending', | ||
}, | ||
{ | ||
ticketId: 'TCK-003', | ||
eventName: 'Broadway Show', | ||
status: 'Cancelled', | ||
}, | ||
]; | ||
|
||
interface Ticket { | ||
ticketId: string; | ||
eventName: string; | ||
status: 'Cancelled' | 'Pending' | 'Confirmed'; | ||
} | ||
|
||
export default () => { | ||
const [tickets, setTickets] = useState(rows); | ||
|
||
const handleViewDetails = (ticket: Ticket) => { | ||
alert( | ||
`Ticket ID: ${ticket.ticketId}\nEvent: ${ticket.eventName}\nStatus: ${ticket.status}` | ||
); | ||
}; | ||
|
||
return ( | ||
<Table aria-label="Data Table" size="compact" variant="linedTable" stretch> | ||
<Table.Header> | ||
<Table.Column>ID</Table.Column> | ||
<Table.Column>Event Name</Table.Column> | ||
<Table.Column>Status</Table.Column> | ||
<Table.Column>Action</Table.Column> | ||
</Table.Header> | ||
<Table.Body items={rows}> | ||
{tickets.map((ticket: Ticket) => ( | ||
<Table.Row key={ticket.ticketId}> | ||
<Table.Cell>{ticket.ticketId}</Table.Cell> | ||
<Table.Cell>{ticket.eventName}</Table.Cell> | ||
<Table.Cell>{ticket.status}</Table.Cell> | ||
<Table.Cell> | ||
<ActionMenu> | ||
<Menu.Item | ||
onAction={() => handleViewDetails(ticket)} | ||
id="view-details" | ||
> | ||
View Details | ||
</Menu.Item> | ||
<Menu.Item | ||
onAction={() => | ||
setTickets( | ||
tickets.filter( | ||
ticketItem => ticketItem.ticketId !== ticket.ticketId | ||
) | ||
) | ||
} | ||
id="delete" | ||
> | ||
Delete | ||
</Menu.Item> | ||
</ActionMenu> | ||
</Table.Cell> | ||
</Table.Row> | ||
))} | ||
</Table.Body> | ||
</Table> | ||
); | ||
}; |
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
14 changes: 14 additions & 0 deletions
14
docs/content/components/overlay/menu/menu-appearance.demo.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,14 @@ | ||
import { Menu } from '@marigold/components'; | ||
|
||
export default () => { | ||
return ( | ||
<Menu | ||
label="Ticket Options" | ||
onAction={action => alert(`Action: ${action}`)} | ||
> | ||
<Menu.Item id="view">View Ticket Details</Menu.Item> | ||
<Menu.Item id="transfer">Transfer Ticket</Menu.Item> | ||
<Menu.Item id="refund">Request Refund</Menu.Item> | ||
</Menu> | ||
); | ||
}; |
11 changes: 6 additions & 5 deletions
11
docs/content/components/overlay/menu/menu-disabled.demo.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,12 +1,13 @@ | ||
import React from 'react'; | ||
import { Menu } from '@marigold/components'; | ||
|
||
export default () => { | ||
return ( | ||
<Menu label="Choose" disabledKeys={['salad', 'pizza']}> | ||
<Menu.Item id="burger">🍔 Burger</Menu.Item> | ||
<Menu.Item id="pizza">🍕 Pizza</Menu.Item> | ||
<Menu.Item id="salad">🥗 Salad</Menu.Item> | ||
<Menu.Item id="fries">🍟 Fries</Menu.Item> | ||
<Menu label="Ticket Options" disabledKeys={['upgrade', 'resell']}> | ||
<Menu.Item id="view">👁️ View Ticket Details</Menu.Item> | ||
<Menu.Item id="download">📥 Download Ticket</Menu.Item> | ||
<Menu.Item id="upgrade">⬆️ Upgrade Seat</Menu.Item> | ||
<Menu.Item id="resell">💸 Resell Ticket</Menu.Item> | ||
</Menu> | ||
); | ||
}; |
19 changes: 10 additions & 9 deletions
19
docs/content/components/overlay/menu/menu-section.demo.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
26 changes: 16 additions & 10 deletions
26
docs/content/components/overlay/menu/menu-selection.demo.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,16 +1,22 @@ | ||
import React, { useState } from 'react'; | ||
import { Menu } from '@marigold/components'; | ||
|
||
export default () => { | ||
const [preferences, setPreferences] = useState(['newsletter']); | ||
return ( | ||
<Menu | ||
label="Hogwarts Houses" | ||
selectionMode="single" | ||
selectedKeys={['gryffindor']} | ||
> | ||
<Menu.Item id="gryffindor">🦁 Gryffindor</Menu.Item> | ||
<Menu.Item id="hufflepuff">🦡 Hufflepuff</Menu.Item> | ||
<Menu.Item id="ravenclaw">🐦⬛ Ravenclaw</Menu.Item> | ||
<Menu.Item id="slytherin">🐍 Slytherin</Menu.Item> | ||
</Menu> | ||
<> | ||
<Menu | ||
label="Select Your Preference" | ||
selectionMode="multiple" | ||
selectedKeys={preferences} | ||
onSelectionChange={setPreferences as (keys: any) => void} | ||
> | ||
<Menu.Item id="newsletter">📧 Subscribe to Newsletter</Menu.Item> | ||
<Menu.Item id="offers">💸 Receive Special Offers</Menu.Item> | ||
<Menu.Item id="updates">🔔 Get Product Updates</Menu.Item> | ||
<Menu.Item id="events">🎉 Event Invitations</Menu.Item> | ||
</Menu>{' '} | ||
<pre>Your preferences are : {[...preferences].join(', ')}</pre> | ||
</> | ||
); | ||
}; |
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.