refactor molecule components to use .withProps() subcomponents and extract inline code
- Add UnstyledButton listItem theme variant to replace inline style for border-radius - Extract subcomponent constants with .withProps() across all molecules - Replace raw <span /> with Mantine <Flex /> in ResourcePreviewPanel - Extract inline template literals and expressions to named functions Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
04c23094a4
commit
27186c2ff7
1 changed files with 666 additions and 356 deletions
|
|
@ -27,6 +27,21 @@ export interface RootsTableProps {
|
|||
onBrowse: () => void;
|
||||
}
|
||||
|
||||
const HintText = Text.withProps({
|
||||
size: "sm",
|
||||
c: "dimmed",
|
||||
});
|
||||
|
||||
const RemoveIcon = ActionIcon.withProps({
|
||||
color: "red",
|
||||
variant: "subtle",
|
||||
});
|
||||
|
||||
const AddRootButton = Button.withProps({
|
||||
variant: "light",
|
||||
fullWidth: true,
|
||||
});
|
||||
|
||||
export function RootsTable({
|
||||
roots,
|
||||
newRootName,
|
||||
|
|
@ -40,9 +55,7 @@ export function RootsTable({
|
|||
return (
|
||||
<Stack gap="md">
|
||||
<Title order={4}>Roots Configuration</Title>
|
||||
<Text size="sm" c="dimmed">
|
||||
Filesystem roots exposed to the connected server:
|
||||
</Text>
|
||||
<HintText>Filesystem roots exposed to the connected server:</HintText>
|
||||
|
||||
{roots.length > 0 && (
|
||||
<Table>
|
||||
|
|
@ -59,13 +72,9 @@ export function RootsTable({
|
|||
<Table.Td>{root.name}</Table.Td>
|
||||
<Table.Td>{root.uri}</Table.Td>
|
||||
<Table.Td>
|
||||
<ActionIcon
|
||||
color="red"
|
||||
variant="subtle"
|
||||
onClick={() => onRemoveRoot(root.uri)}
|
||||
>
|
||||
<RemoveIcon onClick={() => onRemoveRoot(root.uri)}>
|
||||
X
|
||||
</ActionIcon>
|
||||
</RemoveIcon>
|
||||
</Table.Td>
|
||||
</Table.Tr>
|
||||
))}
|
||||
|
|
@ -73,9 +82,7 @@ export function RootsTable({
|
|||
</Table>
|
||||
)}
|
||||
|
||||
<Button variant="light" fullWidth onClick={onAddRoot}>
|
||||
+ Add Root
|
||||
</Button>
|
||||
<AddRootButton onClick={onAddRoot}>+ Add Root</AddRootButton>
|
||||
|
||||
<Divider />
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue