Skip to content

Commit 475e409

Browse files
committed
✨ Add secondary theme to lists
1 parent 4e5a353 commit 475e409

File tree

7 files changed

+26
-10
lines changed

7 files changed

+26
-10
lines changed

src/components/List/List.astro

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,20 @@ const {
1919
id,
2020
className,
2121
wrapperClassName,
22+
secondary,
2223
itemGroups
2324
} = Astro.props
2425
2526
const classes = [
2627
styles.list,
28+
(secondary && !showSearchBar) && styles.secondary,
2729
!showSearchBar && styles.container,
2830
className
2931
]
3032
3133
const wrapperClasses = [
3234
styles.container,
35+
secondary && styles.secondary,
3336
wrapperClassName
3437
]
3538
---

src/components/List/List.svelte

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
id,
2020
className,
2121
wrapperClassName,
22+
secondary,
2223
itemGroups = $bindable([]),
2324
onSelect
2425
}: SvelteListProps = $props()
@@ -28,12 +29,14 @@
2829
2930
const classes = classNames([
3031
styles.list,
32+
(secondary && !showSearchBar) && styles.secondary,
3133
!showSearchBar && styles.container,
3234
className
3335
])
3436
3537
const wrapperClasses = classNames([
3638
styles.container,
39+
secondary && styles.secondary,
3740
wrapperClassName
3841
])
3942

src/components/List/List.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ const List = ({
1919
id,
2020
className,
2121
wrapperClassName,
22+
secondary,
2223
itemGroups,
2324
onSelect
2425
}: ReactListProps) => {
@@ -28,12 +29,14 @@ const List = ({
2829

2930
const classes = classNames([
3031
styles.list,
32+
(secondary && !showSearchBar) && styles.secondary,
3133
!showSearchBar && styles.container,
3234
className
3335
])
3436

3537
const wrapperClasses = classNames([
3638
styles.container,
39+
secondary && styles.secondary,
3740
wrapperClassName
3841
])
3942

src/components/List/list.module.scss

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,11 @@
8585
.container {
8686
@include border-radius(md);
8787
@include border(primary-50);
88+
@include background(primary-70);
89+
90+
&.secondary {
91+
@include background(primary-60);
92+
}
8893

8994
input {
9095
@include border(top, 0);

src/components/List/list.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ export type ListProps = {
1515
id?: string
1616
className?: string
1717
wrapperClassName?: string
18+
secondary?: boolean
1819
itemGroups: {
1920
title?: string
2021
items: {

src/pages/components/list.astro

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -64,49 +64,50 @@ const sections = getSections({
6464
{section.subTitle && <h2 set:html={section.subTitle} />}
6565
</Fragment>
6666
<div class="grid md-2 lg-3">
67-
<ComponentWrapper title="Default">
67+
<ComponentWrapper title="Default" secondary={true}>
6868
<section.component itemGroups={list} />
6969
</ComponentWrapper>
7070

71-
<ComponentWrapper title="Item with icons">
72-
<section.component itemGroups={listWithIcons} />
71+
<ComponentWrapper title="Item with icons (secondary)">
72+
<section.component itemGroups={listWithIcons} secondary={true} />
7373
</ComponentWrapper>
7474

75-
<ComponentWrapper title="Item with icons & subText">
75+
<ComponentWrapper title="Item with icons & subText" secondary={true}>
7676
<section.component itemGroups={listWithSubText} />
7777
</ComponentWrapper>
7878

79-
<ComponentWrapper title="Grouped item">
79+
<ComponentWrapper title="Grouped item" secondary={true}>
8080
<section.component itemGroups={listWithGroups} />
8181
</ComponentWrapper>
8282

83-
<ComponentWrapper title="Disabled & selected items">
83+
<ComponentWrapper title="Disabled & selected items" secondary={true}>
8484
<section.component itemGroups={listWithStates} />
8585
</ComponentWrapper>
8686

87-
<ComponentWrapper title="List with scroll">
87+
<ComponentWrapper title="List with scroll" secondary={true}>
8888
<section.component
8989
itemGroups={listWithGroups}
9090
maxHeight="160px"
9191
/>
9292
</ComponentWrapper>
9393

94-
<ComponentWrapper title="List with search bar">
94+
<ComponentWrapper title="List with search bar" secondary={true}>
9595
<section.component
9696
itemGroups={listWithGroups}
9797
showSearchBar={true}
9898
/>
9999
</ComponentWrapper>
100100

101-
<ComponentWrapper title="Search bar with placeholder">
101+
<ComponentWrapper title="Search bar with placeholder (secondary)">
102102
<section.component
103103
itemGroups={listWithGroups}
104104
showSearchBar={true}
105105
searchBarPlaceholder="Search the app..."
106+
secondary={true}
106107
/>
107108
</ComponentWrapper>
108109

109-
<ComponentWrapper title="Search bar with icon & placeholder">
110+
<ComponentWrapper title="Search bar with icon & placeholder" secondary={true}>
110111
<section.component
111112
itemGroups={listWithGroups}
112113
showSearchBar={true}
61.8 KB
Loading

0 commit comments

Comments
 (0)