diff --git a/src/Button/Button.css b/src/Button/Button.css index 2b87e81..8a3a8cd 100644 --- a/src/Button/Button.css +++ b/src/Button/Button.css @@ -38,4 +38,10 @@ button[bt] { --button-color: hsl(42, 93%, 46%); --button-hover-color: hsl(37, 97%, 39%); } + + &[bt-dropdown] > svg { + width: 0.75em; + height: 0.75em; + margin-inline-start: 0.4em; + } } diff --git a/src/Button/Button.stories.ts b/src/Button/Button.stories.ts index 1a9bb73..621630d 100644 --- a/src/Button/Button.stories.ts +++ b/src/Button/Button.stories.ts @@ -23,3 +23,23 @@ export const Red: Story = { export const Yellow: Story = { render: () => html``, }; + +export const Dropdown: Story = { + render: () => + html` +
`, +}; diff --git a/src/Button/Button.ts b/src/Button/Button.ts index 7ce4584..d0d7c19 100644 --- a/src/Button/Button.ts +++ b/src/Button/Button.ts @@ -1,4 +1,11 @@ -import { injectStyles } from '../utils'; +import { injectStyles, onElementConnected } from '../utils'; import styles from './Button.css?raw&inline'; +import dropdownSvg from './dropdown.svg?raw&inline'; injectStyles(styles); + +onElementConnected('button[bt-dropdown] > svg', (svg) => { + if (!svg.hasAttribute('viewBox')) { + svg.outerHTML = dropdownSvg; + } +}); diff --git a/src/Button/dropdown.svg b/src/Button/dropdown.svg new file mode 100644 index 0000000..af307fb --- /dev/null +++ b/src/Button/dropdown.svg @@ -0,0 +1,5 @@ + \ No newline at end of file diff --git a/src/Docs.mdx b/src/Docs.mdx index f3a468e..1b44da4 100644 --- a/src/Docs.mdx +++ b/src/Docs.mdx @@ -39,30 +39,43 @@ body { # Avatar +Selector: `button[bt-avatar]` + # Badge +Selector: `span[bt-badge]` + # Button +Selector: `button[bt]` + + # DropdownMenu +Selector: `ul[bt-dropdown-menu]` + # Header +Selector: `header[bt]` + # Heading +Selector: `h1[bt], h2[bt], h3[bt], h4[bt], h5[bt], h6[bt]` + @@ -70,18 +83,26 @@ body { # Input label +Selector: `label[bt]` + # Loader +Selector: `[role="progressbar"][bt]` + # Main +Selector: `main[bt]` + # Notifications +Selector: `section[bt-notifications]` + # Table +Selector: `table[bt]` + # Text +Selector: `[bt-text]` + diff --git a/src/DropdownMenu/DropdownMenu.stories.ts b/src/DropdownMenu/DropdownMenu.stories.ts index a791054..27bdf11 100644 --- a/src/DropdownMenu/DropdownMenu.stories.ts +++ b/src/DropdownMenu/DropdownMenu.stories.ts @@ -4,8 +4,8 @@ import { html } from 'lit'; const meta: Meta = { title: 'BTDropdownMenu', render: () => { - return html`