diff --git a/src/components/button/button.scss b/src/components/button/button.scss index 3d6db4d7..e3810e3e 100644 --- a/src/components/button/button.scss +++ b/src/components/button/button.scss @@ -1,34 +1,52 @@ -@use '../../settings/style'; +@use "../../settings/style"; .mykn-button { --mykn-button-color-background: var(--theme-color-primary-800); --mykn-button-color-shadow: var(--theme-shade-1000); --mykn-button-color-text: var(--theme-shade-0); + --mykn-button-height: auto; + --mykn-button-width: auto; --mykn-button-offset: 0px; + --mykn-button-padding-v: var(--spacing-v-s); + --mykn-button-padding-h: var(--spacing-h-s); align-items: center; appearance: none; margin: 0; - padding: var(--spacing-v-s) var(--spacing-h-s); + padding: var(--mykn-button-padding-v) var(--mykn-button-padding-h); background-color: var(--mykn-button-color-background); border: 1px solid var(--mykn-button-color-border); border-radius: 4px; - box-shadow: 0 calc(var(--mykn-button-offset) * -1) var(--mykn-button-color-shadow); + box-shadow: 0 calc(var(--mykn-button-offset) * -1) + var(--mykn-button-color-shadow); box-sizing: border-box; color: var(--mykn-button-color-text); cursor: pointer; display: inline-flex; flex-wrap: wrap; gap: 0.5em; + height: var(--mykn-button-height); font-family: Inter, sans-serif; font-size: var(--typography-font-size-body-s); justify-content: center; line-height: var(--typography-line-height-body-s); text-align: center; text-decoration: none; - transition: all var(--animation-duration-fast) var(--animation-timing-function); + transition: all var(--animation-duration-fast) + var(--animation-timing-function); transform: translateY(var(--mykn-button-offset)); + width: var(--mykn-button-width); + &--square { + --mykn-button-height: calc( + var(--typography-line-height-body-s) + 2 * var(--spacing-v-s) + ); + --mykn-button-width: calc( + var(--typography-line-height-body-s) + 2 * var(--spacing-v-s) + ); + --mykn-button-padding-v: 0; + --mykn-button-padding-h: 0; + } &--variant-primary { &:focus, @@ -37,13 +55,32 @@ --mykn-button-offset: -2px; } - &[aria-expanded=true], + &[aria-expanded="true"], &:active { --mykn-button-color-background: var(--theme-color-primary-800); --mykn-button-offset: 0px; } } + &--variant-outline { + --mykn-button-color-background: transparent; + --mykn-button-color-border: var(--theme-shade-700); + --mykn-button-color-shadow: currentColor; + --mykn-button-color-text: var(--typography-color-body); + + &:focus, + &:hover { + --mykn-button-color-background: var(--theme-color-primary-200); + --mykn-button-offset: -2px; + } + + &[aria-expanded="true"], + &:active { + --mykn-button-color-background: var(--typography-color-background); + --mykn-button-offset: 0px; + } + } + &--variant-transparent { --mykn-button-color-background: transparent; --mykn-button-color-shadow: currentColor; @@ -55,7 +92,7 @@ --mykn-button-offset: -2px; } - &[aria-expanded=true], + &[aria-expanded="true"], &:active { --mykn-button-color-background: var(--typography-color-background); --mykn-button-offset: 0px; diff --git a/src/components/button/button.tsx b/src/components/button/button.tsx index f5ad249f..fe53c65c 100644 --- a/src/components/button/button.tsx +++ b/src/components/button/button.tsx @@ -4,7 +4,8 @@ import React, { LegacyRef } from "react"; import "./button.scss"; type BaseButtonProps = { - variant?: "primary" | "transparent"; + square?: boolean; + variant?: "primary" | "outline" | "transparent"; }; export type ButtonProps = React.ButtonHTMLAttributes & @@ -20,11 +21,13 @@ export type ButtonLinkProps = React.AnchorHTMLAttributes & * @constructor */ export const Button = React.forwardRef( - ({ variant = "primary", ...props }, ref) => { + ({ square = false, variant = "primary", ...props }, ref) => { return ( + + + {labelLoading && ( +