Skip to content

Commit f6bf3c7

Browse files
authored
Merge pull request #817 from NoelDeMartin/769-header
#769 Prepare utils for Header component
2 parents 675688b + 41f4897 commit f6bf3c7

24 files changed

Lines changed: 112 additions & 1761 deletions

package-lock.json

Lines changed: 6 additions & 34 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "solid-ui",
3-
"version": "3.1.3-7",
3+
"version": "3.1.3-8",
44
"description": "UI library for Solid applications",
55
"main": "dist/index.cjs.js",
66
"types": "dist/index.d.ts",
@@ -26,6 +26,12 @@
2626
"types": "./dist/theme.css.d.ts",
2727
"import": "./dist/theme.css",
2828
"require": "./dist/theme.css"
29+
},
30+
"./breakpoints.css": {
31+
"style": "./dist/breakpoints.css",
32+
"types": "./dist/breakpoints.css.d.ts",
33+
"import": "./dist/breakpoints.css",
34+
"require": "./dist/breakpoints.css"
2935
}
3036
},
3137
"files": [
@@ -115,7 +121,6 @@
115121
"@storybook/addon-docs": "10.4.2",
116122
"@storybook/addon-links": "10.4.2",
117123
"@storybook/web-components-vite": "10.4.2",
118-
"@tailwindcss/postcss": "^4.3.0",
119124
"@tailwindcss/vite": "^4.3.0",
120125
"@testing-library/dom": "^10.4.1",
121126
"@testing-library/user-event": "^13.5.0",

src/assets/icons/solid-emblem.svg

Lines changed: 1 addition & 0 deletions
Loading

src/components/account/Account.stories.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ const meta = {
1313
}
1414
} as const
1515

16-
const render = defineAuthStoryRender<typeof meta.argTypes>(() => html`<solid-ui-account></solid-ui-account>`)
16+
const render = defineAuthStoryRender(() => html`<solid-ui-account></solid-ui-account>`)
1717

1818
export default meta
1919

src/components/account/Account.ts

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { consume } from '@lit/context'
2-
import { html } from 'lit'
2+
import { html, nothing, TemplateResult } from 'lit'
3+
import { property } from 'lit/decorators.js'
34
import { customElement, WebComponent } from '@/lib/components'
45
import { authContext, AuthContext, DEFAULT_AUTH_CONTEXT } from '@/lib/auth'
56

@@ -17,13 +18,22 @@ import '~icons/lucide/user'
1718

1819
import styles from './Account.styles.css'
1920

21+
export interface AccountMenuItem {
22+
label: string | TemplateResult
23+
href?: string
24+
onSelected?(): void
25+
}
26+
2027
@customElement('solid-ui-account')
2128
export default class Account extends WebComponent {
2229
static styles = styles
2330
static states = {
2431
loggedIn: (component: Account) => !!component.auth.account,
2532
}
2633

34+
@property({ type: Array })
35+
accessor menuItems: AccountMenuItem[] = []
36+
2737
@consume({ context: authContext, subscribe: true })
2838
private accessor auth: AuthContext = DEFAULT_AUTH_CONTEXT
2939

@@ -66,6 +76,11 @@ export default class Account extends WebComponent {
6676
<icon-lucide-chevron-down slot="right-icon"></icon-lucide-chevron-down>
6777
</button>
6878
79+
${this.menuItems.map(menuItem => html`
80+
<solid-ui-menu-item .href=${menuItem.href ?? nothing} @solid-ui-select=${() => menuItem.onSelected?.()}>
81+
${menuItem.label}
82+
</solid-ui-menu-item>
83+
`)}
6984
<solid-ui-logout-button>
7085
<solid-ui-menu-item slot="trigger">
7186
<icon-lucide-log-out slot="left-icon"></icon-lucide-log-out>

src/components/account/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import Account from './Account'
1+
import Account, { type AccountMenuItem } from './Account'
22

3-
export { Account }
3+
export { Account, type AccountMenuItem }
44
export default Account

src/components/header/index.ts

Lines changed: 0 additions & 1 deletion
This file was deleted.

src/components/menu-item/MenuItem.styles.css

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,18 @@
11
:host {
2-
width: 100%;
3-
display: flex;
4-
position: relative;
5-
justify-content: flex-start;
6-
align-items: center;
7-
gap: 5px;
8-
padding: 10px;
9-
border-radius: 5px;
10-
color: var(--solid-ui-color-gray-600);
11-
font-weight: 500;
12-
font-size: var(--solid-ui-font-size-md);
2+
& > a,
3+
& > div {
4+
width: 100%;
5+
display: flex;
6+
position: relative;
7+
justify-content: flex-start;
8+
align-items: center;
9+
gap: 5px;
10+
padding: 10px;
11+
border-radius: 5px;
12+
color: var(--solid-ui-color-gray-600);
13+
font-weight: 500;
14+
font-size: var(--solid-ui-font-size-md);
15+
}
1316

1417
&:hover {
1518
background-color: var(--solid-ui-color-slate-200);

src/components/menu-item/MenuItem.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,11 @@ export default class MenuItem extends WebComponent {
2626
}
2727

2828
return html`
29-
<slot name="left-icon"></slot>
30-
<slot></slot>
31-
<slot name="right-icon"></slot>
29+
<div>
30+
<slot name="left-icon"></slot>
31+
<slot></slot>
32+
<slot name="right-icon"></slot>
33+
</div>
3234
`
3335
}
3436

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
:host {
2+
display: inline-flex;
3+
}

0 commit comments

Comments
 (0)