-
Notifications
You must be signed in to change notification settings - Fork 0
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
Showing
21 changed files
with
102 additions
and
90 deletions.
There are no files selected for viewing
19 changes: 19 additions & 0 deletions
19
apps/web/src/app/features/demo/demo-feature-info-table.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,19 @@ | ||
import { Button, rem } from '@mantine/core' | ||
import { UiAvatar, UiCard, UiInfoItems, UiInfoTable, UiStack } from '@pubkey-ui/core' | ||
|
||
export function DemoFeatureInfoTable() { | ||
const info: UiInfoItems = [ | ||
['Name', 'John Doe'], | ||
['Email', '[email protected]'], | ||
['Phone', '555-555-5555'], | ||
['Components', <Button variant="link">Edit</Button>], | ||
['Avatar', <UiAvatar size={rem(40)} radius="xl" url="https://i.pravatar.cc/300" alt="John Doe" />], | ||
] | ||
return ( | ||
<UiCard title="InfoTable"> | ||
<UiStack gap="xl"> | ||
<UiInfoTable items={info} /> | ||
</UiStack> | ||
</UiCard> | ||
) | ||
} |
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './ui-info-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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { Table, TableProps } from '@mantine/core' | ||
import { ReactNode } from 'react' | ||
|
||
export type UiInfoItem = [ReactNode, ReactNode] | undefined | ||
export type UiInfoItems = UiInfoItem[] | ||
export type UiInfoTableProps = TableProps & { items: UiInfoItems; tdw?: string } | ||
|
||
export function UiInfoTable({ items, tdw = '25%', ...props }: UiInfoTableProps) { | ||
const filtered = items.filter(Boolean) as [ReactNode, ReactNode][] | ||
if (!filtered.length) return null | ||
return ( | ||
<Table {...props}> | ||
<Table.Tbody> | ||
{filtered.map(([key, value], index) => ( | ||
<Table.Tr key={index}> | ||
<Table.Td w={tdw}>{key}</Table.Td> | ||
<Table.Th>{value}</Table.Th> | ||
</Table.Tr> | ||
))} | ||
</Table.Tbody> | ||
</Table> | ||
) | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.