feat: add Button component with primary and secondary styles, including disabled state
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
@use '../../styles/tokens/typography' as *;
|
||||
|
||||
.button {
|
||||
width: fit-content;
|
||||
padding: var(--nds-spacing-sm) var(--nds-spacing-md);
|
||||
border-radius: var(--nds-radius-sm);
|
||||
@include text-base;
|
||||
cursor: pointer;
|
||||
&__primary {
|
||||
background-color: var(--nds-primary);
|
||||
color: var(--nds-text);
|
||||
&:hover:not(.button--disabled) {
|
||||
background-color: var(--nds-secondary);
|
||||
}
|
||||
&:active:not(.button--disabled) {
|
||||
background-color: var(--nds-accent);
|
||||
color: var(--nds-background);
|
||||
}
|
||||
}
|
||||
&__secondary {
|
||||
border: var(--nds-border-width-medium) solid;
|
||||
border-color: var(--nds-primary);
|
||||
color: var(--nds-primary);
|
||||
&:hover:not(.button--disabled) {
|
||||
border-color: var(--nds-secondary);
|
||||
}
|
||||
&:active:not(.button--disabled) {
|
||||
border-color: var(--nds-accent);
|
||||
color: var(--nds-accent);
|
||||
}
|
||||
}
|
||||
&--disabled {
|
||||
cursor: not-allowed;
|
||||
background-color: var(--nds-disabled);
|
||||
color: var(--nds-neutral);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
---
|
||||
export interface Props {
|
||||
type: 'primary' | 'secondary';
|
||||
disabled?: boolean;
|
||||
}
|
||||
const { type, disabled = false } = Astro.props;
|
||||
---
|
||||
|
||||
<div class={`button button__${type} ${disabled ? 'button--disabled' : ''}`}>
|
||||
<slot/>
|
||||
</div>
|
||||
|
||||
<style lang="scss">
|
||||
@use './_button.scss';
|
||||
</style>
|
||||
@@ -5,4 +5,5 @@ export { default as Notification } from './Notifications/notification.astro';
|
||||
export { default as Toggle } from './Toggle/toggle.astro';
|
||||
export { default as Tab } from './Tabs/tab.astro';
|
||||
export { default as TabItem } from './Tabs/tabItem.astro';
|
||||
export { default as TabContent } from './Tabs/tabContent.astro';
|
||||
export { default as TabContent } from './Tabs/tabContent.astro';
|
||||
export { default as Button } from './Button/button.astro';
|
||||
Reference in New Issue
Block a user