-
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.
refactor: UI for the widget dependencies table (#411)
* refactor: widget dependencies * fix import name
- Loading branch information
1 parent
e311b51
commit e7e0896
Showing
3 changed files
with
58 additions
and
70 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
import { Code, Inset, Link, Popover, Table, Text } from "@radix-ui/themes"; | ||
import { memo } from "react"; | ||
|
||
interface DependenciesProps { | ||
dependencies: Record<string, string>; | ||
} | ||
|
||
const Dependencies = memo(({ dependencies }: DependenciesProps) => { | ||
const dependenciesArray = Object.entries(dependencies); | ||
|
||
return dependenciesArray.length > 0 ? ( | ||
<Popover.Root> | ||
<Popover.Trigger> | ||
<Link title="View the dependencies" asChild> | ||
<button>View ({dependenciesArray.length})</button> | ||
</Link> | ||
</Popover.Trigger> | ||
<Popover.Content size="1"> | ||
<Inset side="all"> | ||
<Table.Root | ||
size="1" | ||
css={{ | ||
"--table-cell-padding": "var(--space-1) var(--space-2)", | ||
"--table-cell-min-height": 0, | ||
"[data-radix-scroll-area-viewport]": { maxHeight: "150px" }, | ||
"& tr:last-child": { "--table-row-box-shadow": "none" }, | ||
}} | ||
> | ||
<Table.Body> | ||
{dependenciesArray.map(([name, version]) => ( | ||
<Table.Row key={name}> | ||
<Table.RowHeaderCell> | ||
<Link | ||
href={`https://www.npmjs.com/package/${name}`} | ||
target="_blank" | ||
rel="noreferrer" | ||
> | ||
{name} | ||
</Link> | ||
</Table.RowHeaderCell> | ||
<Table.Cell> | ||
<Code variant="ghost">{version}</Code> | ||
</Table.Cell> | ||
</Table.Row> | ||
))} | ||
</Table.Body> | ||
</Table.Root> | ||
</Inset> | ||
</Popover.Content> | ||
</Popover.Root> | ||
) : ( | ||
<Text color="gray">None</Text> | ||
); | ||
}); | ||
|
||
export default Dependencies; |
This file was deleted.
Oops, something went wrong.