Skip to content

Commit

Permalink
update button styles
Browse files Browse the repository at this point in the history
  • Loading branch information
jinkang-0 committed Jan 11, 2024
1 parent 40a46f3 commit 1eb3dbe
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 22 deletions.
42 changes: 22 additions & 20 deletions src/components/Button.astro
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
---
interface Props {
href?: string; // no href = disabled
primary?: boolean;
menu?: boolean;
variant?: 'primary' | 'secondary' | 'menu';
}
const { href, primary, menu, ...rest } = Astro.props;
const { href, variant = 'primary', ...rest } = Astro.props;
const classes = [];
const classes: string[] = [];
if (!href) classes.push('disabled');
if (primary) classes.push('primary');
if (menu) classes.push('menu');
if (variant !== 'secondary') classes.push('primary');
if (variant === 'menu') classes.push('menu');
---

<a
Expand All @@ -26,6 +25,9 @@ if (menu) classes.push('menu');
<style lang="scss">
@use '../styles/colors';

$primary-hover: #6dbeda;
$primary-pressed: #53a0bc;

a {
border-radius: 8px;
padding: 1.25rem;
Expand All @@ -37,25 +39,25 @@ if (menu) classes.push('menu');
gap: 0.5rem;
cursor: pointer;
transition: 100ms;
}

a.menu {
padding: 0.75rem;
}

a.disabled {
cursor: default;
}
&.menu {
padding: 0.75rem;
}

a:not(.disabled):hover {
filter: brightness(0.97);
}

a:not(.disabled):active {
filter: brightness(0.95);
&.disabled {
cursor: default;
}
}

a.primary {
background-color: colors.$primary;

&:hover {
background-color: $primary-hover;
}

&:active {
background-color: $primary-pressed;
}
}
</style>
4 changes: 2 additions & 2 deletions src/graphics/redirect_arrow.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 1eb3dbe

Please sign in to comment.