Skip to content

Commit

Permalink
fix button hover and variants
Browse files Browse the repository at this point in the history
  • Loading branch information
GuillaumeRx committed Sep 26, 2024
1 parent c71c560 commit 6cf07fe
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
8 changes: 8 additions & 0 deletions ui/components/app/snaps/snap-ui-footer-button/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,14 @@
}
}

&.mm-button-secondary {
&:hover:not(&--disabled) {
& > span {
color: var(--color-primary-inverse);
}
}
}

&--disabled {
cursor: default !important;
}
Expand Down
9 changes: 7 additions & 2 deletions ui/components/app/snaps/snap-ui-renderer/components/footer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ const getDefaultButtons = (
key: 'default-button',
props: {
onCancel,
variant: ButtonVariant.Secondary,
isSnapAction: false,
},
children: t('cancel'),
Expand All @@ -62,8 +63,9 @@ export const footer: UIComponentFactory<FooterElement> = ({
}) => {
const defaultButtons = getDefaultButtons(element, t, onCancel);

const providedChildren = getJsxChildren(element);
const footerChildren: UIComponent[] = (
getJsxChildren(element) as ButtonElement[]
providedChildren as ButtonElement[]
).map((children, index) => {
const buttonMapped = buttonFn({
...params,
Expand All @@ -74,7 +76,10 @@ export const footer: UIComponentFactory<FooterElement> = ({
key: `snap-footer-button-${buttonMapped.props?.name ?? index}`,
props: {
...buttonMapped.props,
variant: index === 0 ? ButtonVariant.Secondary : ButtonVariant.Primary,
variant:
providedChildren.length === 2 && index === 0
? ButtonVariant.Secondary
: ButtonVariant.Primary,
isSnapAction: true,
},
children: buttonMapped.children,
Expand Down

0 comments on commit 6cf07fe

Please sign in to comment.