Skip to content

Commit

Permalink
Merge pull request #983 from IntersectMBO/926-drep-panel-needs-to-be-…
Browse files Browse the repository at this point in the history
…clickable

[#926] DRep panel needs to be clickable
  • Loading branch information
JanJaroszczak authored May 14, 2024
2 parents 16a578b + b32b138 commit 2e095a7
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 8 deletions.
3 changes: 3 additions & 0 deletions govtool/frontend/src/components/molecules/Card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ type CardProps = PropsWithChildren & {
label?: string;
sx?: SxProps<Theme>;
variant?: "default" | "error" | "primary" | "success" | "warning";
onCardClick?: () => void;
};

const COLORS = {
Expand Down Expand Up @@ -42,6 +43,7 @@ export const Card = ({
elevation = 3,
label,
sx,
onCardClick,
}: CardProps) => {
const colors = COLORS[variant];

Expand All @@ -57,6 +59,7 @@ export const Card = ({
position: "relative",
...sx,
}}
onClick={onCardClick}
>
{label && (
<Chip
Expand Down
10 changes: 4 additions & 6 deletions govtool/frontend/src/components/molecules/DelegationAction.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { DirectVoterActionProps } from "./types";

export const DelegationAction = ({
dRepId,
onClickArrow,
onCardClick,
sx,
}: DirectVoterActionProps) => {
const { t } = useTranslation();
Expand All @@ -27,8 +27,10 @@ export const DelegationAction = ({
justifyContent: "space-between",
px: 1.5,
py: 1,
cursor: "pointer",
...sx,
}}
onCardClick={onCardClick}
>
<Box sx={{ width: "90%" }}>
<Typography fontWeight={600} variant="body2">
Expand All @@ -45,11 +47,7 @@ export const DelegationAction = ({
{dRepId}
</Typography>
</Box>
<ArrowForwardIosIcon
color="primary"
onClick={onClickArrow}
sx={{ cursor: "pointer", height: 16, width: 24 }}
/>
<ArrowForwardIosIcon color="primary" sx={{ height: 16, width: 24 }} />
</Card>
);
};
2 changes: 1 addition & 1 deletion govtool/frontend/src/components/molecules/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export type StepProps = {

export type DirectVoterActionProps = {
dRepId: string;
onClickArrow: () => void;
onCardClick: () => void;
sx?: SxProps;
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ export const DelegateDashboardCard = ({
{displayedDelegationId && (
<DelegationAction
dRepId={displayedDelegationId}
onClickArrow={navigateToDRepDetails}
onCardClick={navigateToDRepDetails}
sx={{ mt: 1.5 }}
/>
)}
Expand Down

0 comments on commit 2e095a7

Please sign in to comment.