From 3cf309b7cdc06b1ab3fc024170809982716e9c64 Mon Sep 17 00:00:00 2001 From: Tom Lanser Date: Wed, 4 Jan 2023 13:57:43 +0100 Subject: [PATCH] feat: Changed the color usage of the action buttons and made the status badge generic Signed-off-by: Tom Lanser --- .../src/components/RecordActions.tsx | 6 +++--- .../connections/ConnectionsTable.tsx | 5 ++--- .../credentials/CredentialsTable.tsx | 5 ++++- .../components/generic/buttons/Buttons.tsx | 4 ++++ .../components/generic/table/StatusBadge.tsx | 10 ++++++++++ .../src/components/proofs/ProofsTable.tsx | 3 ++- .../src/pages/AgentSelectionScreen.tsx | 19 ++++++++++++++++--- 7 files changed, 41 insertions(+), 11 deletions(-) create mode 100644 packages/toolbox-ui/src/components/generic/table/StatusBadge.tsx diff --git a/packages/toolbox-ui/src/components/RecordActions.tsx b/packages/toolbox-ui/src/components/RecordActions.tsx index bcb60fd..0dc6f5f 100644 --- a/packages/toolbox-ui/src/components/RecordActions.tsx +++ b/packages/toolbox-ui/src/components/RecordActions.tsx @@ -2,7 +2,7 @@ import { ActionIcon, Group, Loader } from '@mantine/core' import { IconTrash } from '@tabler/icons' import React from 'react' -import { DangerButton, PrimaryButton } from './generic' +import { PrimaryButton, SecondaryButton } from './generic' interface RecordActionsProps { onDelete?: () => void @@ -20,9 +20,9 @@ export const RecordActions = ({ onAccept, onDecline, onDelete, isLoading }: Reco ), onDecline && ( - + Decline - + ), onDelete && ( diff --git a/packages/toolbox-ui/src/components/connections/ConnectionsTable.tsx b/packages/toolbox-ui/src/components/connections/ConnectionsTable.tsx index b50119f..7ff1db2 100644 --- a/packages/toolbox-ui/src/components/connections/ConnectionsTable.tsx +++ b/packages/toolbox-ui/src/components/connections/ConnectionsTable.tsx @@ -6,6 +6,7 @@ import React from 'react' import { RecordActions } from '../RecordActions' import { SmartAvatar } from '../SmartAvatar' +import { StatusBadge } from '../generic/table/StatusBadge' interface ConnectionsTableProps { records: ConnectionRecord[] @@ -71,9 +72,7 @@ export const ConnectionsTable = ({ records, onDelete, onAccept }: ConnectionsTab - - {record.state} - + {record.state} - {record.state} + + {record.state} + ({ secondary: { backgroundColor: theme.colorScheme === 'dark' ? theme.colors.animoBlack[0] : theme.colors.animoWhite[0], color: theme.colorScheme === 'dark' ? theme.colors.animoWhite[0] : theme.colors.animoBlack[0], + + '&:hover': { + backgroundColor: theme.colorScheme === 'dark' ? theme.colors.animoBlack[1] : theme.colors.animoWhite[1], + }, }, })) diff --git a/packages/toolbox-ui/src/components/generic/table/StatusBadge.tsx b/packages/toolbox-ui/src/components/generic/table/StatusBadge.tsx new file mode 100644 index 0000000..fb27c35 --- /dev/null +++ b/packages/toolbox-ui/src/components/generic/table/StatusBadge.tsx @@ -0,0 +1,10 @@ +import type { BadgeProps } from '@mantine/core' + +import { Badge, useMantineTheme } from '@mantine/core' +import React from 'react' + +export const StatusBadge = (props: BadgeProps) => { + const { colorScheme } = useMantineTheme() + + return +} diff --git a/packages/toolbox-ui/src/components/proofs/ProofsTable.tsx b/packages/toolbox-ui/src/components/proofs/ProofsTable.tsx index 6e76fbb..24ac616 100644 --- a/packages/toolbox-ui/src/components/proofs/ProofsTable.tsx +++ b/packages/toolbox-ui/src/components/proofs/ProofsTable.tsx @@ -7,6 +7,7 @@ import React from 'react' import { useProofsFormatData } from '../../contexts/ProofsFormatDataProvider' import { RecordActions } from '../RecordActions' import { SmartAvatar } from '../SmartAvatar' +import { StatusBadge } from "../generic/table/StatusBadge"; interface ProofsTableProps { records: ProofExchangeRecord[] @@ -80,7 +81,7 @@ export const ProofsTable = ({ records, connections, onDelete, onAccept, onDeclin - {record.state} + {record.state} ({ + card: { + backgroundColor: theme.colorScheme === 'dark' ? theme.colors.dark[6] : theme.colors.gray[0], + boxShadow: theme.shadows.xs, + transition: 'background-color 0.2s ease', + + '&:hover': { + backgroundColor: theme.colorScheme === 'dark' ? theme.colors.dark[5] : theme.colors.gray[1], + }, + }, +})) + export const AgentSelectionScreen = () => { + const { classes } = useStyles() const navigation = useNavigation() const { agents, setCurrentAgentId, loading } = useAgentManager() @@ -22,12 +35,12 @@ export const AgentSelectionScreen = () => { return ( - Agents + Agents {agents.map((agent) => ( switchToAgent(agent.id)}> - + {agent.agentConfig.label}