Skip to content

Commit cc2b9bd

Browse files
committed
🔥 Simplify Group component
1 parent dc94487 commit cc2b9bd

File tree

7 files changed

+14
-20
lines changed

7 files changed

+14
-20
lines changed

src/components/Group/Group.astro

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,12 @@ interface Props extends GroupProps {}
77
88
const {
99
withSeparator,
10-
outline,
1110
className
1211
} = Astro.props
1312
1413
const classes = [
1514
styles.group,
1615
withSeparator && styles.separator,
17-
outline && styles.outline,
1816
className
1917
]
2018
---

src/components/Group/Group.svelte

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,11 @@
66
import styles from './group.module.scss'
77
88
export let withSeparator: GroupProps['withSeparator'] = false
9-
export let outline: GroupProps['outline'] = false
109
export let className: GroupProps['className'] = ''
1110
1211
const classes = classNames([
1312
styles.group,
1413
withSeparator && styles.separator,
15-
outline && styles.outline,
1614
className
1715
])
1816
</script>

src/components/Group/Group.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,12 @@ import styles from './group.module.scss'
77

88
const Group = ({
99
withSeparator,
10-
outline,
1110
className,
1211
children
1312
}: ReactGroupProps) => {
1413
const classes = classNames([
1514
styles.group,
1615
withSeparator && styles.separator,
17-
outline && styles.outline,
1816
className
1917
])
2018

src/components/Group/group.module.scss

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
.group {
44
@include layout(flex, none);
5+
@include visibility(auto);
56

67
button,
78
span {
@@ -16,17 +17,9 @@
1617
}
1718
}
1819

19-
&.separator button,
20-
&.separator span {
21-
@include border(1px, primary-70);
22-
23-
&:first-child {
24-
@include border(right, 0);
25-
}
26-
27-
&:last-child {
28-
@include border(left, 0);
29-
}
20+
&.separator button:not(:last-child),
21+
&.separator span:not(:last-child) {
22+
@include border(1px, right, primary-70);
3023
}
3124

3225
&.outline button

src/components/Group/group.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
export type GroupProps = {
22
withSeparator?: boolean
3-
outline?: boolean
43
className?: string
54
}
65

src/pages/group.astro

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ const sections = getSections({
6767
</ComponentWrapper>
6868

6969
<ComponentWrapper title="Outline buttons">
70-
<section.component outline={true}>
70+
<section.component>
7171
<Button theme="outline">Profile</Button>
7272
<Button theme="outline">Preferences</Button>
7373
<Button theme="outline">Settings</Button>
@@ -163,7 +163,7 @@ const sections = getSections({
163163
</ComponentWrapper>
164164

165165
<ComponentWrapper title="Outline badges">
166-
<section.component outline={true}>
166+
<section.component>
167167
<Badge theme="outline" hover={true}>Profile</Badge>
168168
<Badge theme="outline" hover={true}>Preferences</Badge>
169169
<Badge theme="outline" hover={true}>Settings</Badge>

src/pages/index.astro

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import Badge from '@components/Badge/Badge.astro'
1010
import Button from '@components/Button/Button.astro'
1111
import Checkbox from '@components/Checkbox/Checkbox.astro'
1212
import Collapsible from '@components/Collapsible/Collapsible.astro'
13+
import Group from '@components/Group/Group.astro'
1314
import Icon from '@components/Icon/Icon.astro'
1415
import Input from '@components/Input/Input.astro'
1516
import List from '@components/List/List.astro'
@@ -113,6 +114,13 @@ const tabItems = [{
113114
<Badge slot="on">Expand</Badge>
114115
</Collapsible>
115116
</CardWrapper>
117+
<CardWrapper title="Group" href="/group">
118+
<Group withSeparator={true}>
119+
<Button theme="secondary">Profile</Button>
120+
<Button theme="secondary">Repos</Button>
121+
<Button theme="secondary">Stars</Button>
122+
</Group>
123+
</CardWrapper>
116124
<CardWrapper title="Icon" href="/icon">
117125
<Icon
118126
type="github"

0 commit comments

Comments
 (0)