-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into download-reviews-from-modal
- Loading branch information
Showing
133 changed files
with
8,748 additions
and
2,717 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import {Primary, Controls, Stories, Meta, Description} from '@storybook/blocks'; | ||
|
||
import * as ButtonIconStories from './ButtonIcon.stories.js'; | ||
|
||
<Meta of={ButtonIconStories} /> | ||
|
||
# ButtonIcon | ||
|
||
## Usage | ||
|
||
Use the ButtonIcon component to create a button that displays only an icon, without any visible text. | ||
|
||
## Accessibility | ||
|
||
Since the button has no visible text, use a descriptive aria-label to ensure it's accessible to screen reader users. | ||
|
||
<Primary /> | ||
<Controls /> | ||
<Stories /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
import ButtonIcon from './ButtonIcon.vue'; | ||
export default { | ||
title: 'Components/ButtonIcon', | ||
component: ButtonIcon, | ||
render: (args) => ({ | ||
components: {ButtonIcon}, | ||
setup() { | ||
return {args}; | ||
}, | ||
template: '<ButtonIcon v-bind="args" />', | ||
}), | ||
}; | ||
|
||
export const Default = { | ||
args: { | ||
icon: 'Add', | ||
ariaLabel: 'Add more items', | ||
}, | ||
}; | ||
|
||
export const Disabled = { | ||
args: { | ||
icon: 'Cancel', | ||
ariaLabel: 'Cancel', | ||
isDisabled: true, | ||
}, | ||
}; | ||
|
||
export const Active = { | ||
args: { | ||
icon: 'Complete', | ||
ariaLabel: 'Complete', | ||
isActive: true, | ||
}, | ||
}; | ||
|
||
export const Order = { | ||
render: (args) => ({ | ||
components: {ButtonIcon}, | ||
setup() { | ||
return {args}; | ||
}, | ||
template: ` | ||
<div class="flex inline-flex items-center items-justify gap-2"> | ||
<ButtonIcon v-for="icon in args.icons" v-bind="icon" /> | ||
</div> | ||
`, | ||
}), | ||
args: { | ||
icons: [ | ||
{ | ||
icon: 'ChevronUp', | ||
ariaLabel: 'Move up', | ||
}, | ||
{ | ||
icon: 'ChevronDown', | ||
ariaLabel: 'Move down', | ||
}, | ||
], | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
<template> | ||
<button :class="styles" :aria-label="ariaLabel" :disabled="isDisabled"> | ||
<Icon class="h-6 w-6" :icon="icon" aria-hidden="true" /> | ||
</button> | ||
</template> | ||
|
||
<script setup> | ||
import {computed} from 'vue'; | ||
import Icon from '@/components/Icon/Icon.vue'; | ||
const props = defineProps({ | ||
/** Icon name to be displayed within the button */ | ||
icon: { | ||
type: String, | ||
required: true, | ||
}, | ||
/** Accessible label for the button. */ | ||
ariaLabel: { | ||
type: String, | ||
default: null, | ||
}, | ||
/** Indicates whether the button is in an active state. */ | ||
isActive: { | ||
type: Boolean, | ||
default: false, | ||
}, | ||
/** Disables the button, making it unclickable and styled as disabled */ | ||
isDisabled: { | ||
type: Boolean, | ||
default: false, | ||
}, | ||
}); | ||
const styles = computed(() => ({ | ||
// Base | ||
'inline-flex relative items-center justify-center text-lg-semibold rounded w-6 h-6': true, | ||
// Default | ||
'text-primary': !props.isActive, | ||
// Hover | ||
'hover:text-on-dark hover:bg-hover': !props.isDisabled, | ||
// Active | ||
'text-on-dark bg-selection-dark border-transparent': props.isActive, | ||
// Disabled | ||
'hover:text-disabled hover:bg-secondary !text-disabled cursor-not-allowed': | ||
props.isDisabled, | ||
})); | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.