Skip to content

Commit 1c05443

Browse files
committed
✨ Improve components usability, simplify logic, and fix visual bugs
1 parent 8a60322 commit 1c05443

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+402
-271
lines changed

public/img/logo.png

-1.92 KB
Loading

src/components/Accordion/accordion.module.scss

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,15 @@
2323
display: flex;
2424
justify-content: space-between;
2525
align-items: center;
26+
gap: 10px;
2627
width: 100%;
2728
background: transparent;
2829
border: 0;
2930
color: #FFF;
3031
font-size: 16px;
3132
padding: 0;
3233
cursor: pointer;
34+
text-align: left;
3335

3436
svg {
3537
@include Transition(transform);

src/components/Alert/alert.module.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
svg {
3838
width: 20px;
3939
height: 20px;
40+
min-width: 20px;
4041
margin-top: 1px;
4142
}
4243

src/components/Alert/alert.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ export type AlertProps = {
44
titleTag?: string
55
titleProps?: any
66
bodyProps?: any
7-
icon?: string | null
87
className?: string | null
98
theme?: 'info'
109
| 'success'
@@ -16,5 +15,6 @@ export type AlertProps = {
1615
export type ReactAlertProps = {
1716
Element?: keyof JSX.IntrinsicElements
1817
TitleTag?: keyof JSX.IntrinsicElements
18+
icon?: React.ReactNode
1919
children: React.ReactNode
2020
} & Omit<AlertProps, 'titleTag' | 'element'>

src/components/Badge/Badge.astro

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,15 @@ interface Props extends BadgeProps {}
77
const {
88
theme,
99
hover,
10+
className,
1011
...rest
1112
} = Astro.props
1213
1314
const classes = [
1415
styles.badge,
1516
theme && styles[theme],
16-
hover && styles.hover
17+
hover && styles.hover,
18+
className
1719
]
1820
---
1921

src/components/Badge/Badge.svelte

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,13 @@
77
export let theme: SvelteBadgeProps['theme'] = null
88
export let onClick: SvelteBadgeProps['onClick'] = null
99
export let hover: SvelteBadgeProps['hover'] = false
10+
export let className: SvelteBadgeProps['className'] = ''
1011
1112
const classes = classNames([
1213
styles.badge,
1314
theme && styles[theme],
14-
(onClick || hover) && styles.hover
15+
(onClick || hover) && styles.hover,
16+
className
1517
])
1618
</script>
1719

src/components/Badge/Badge.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,15 @@ const Badge = ({
88
theme,
99
onClick,
1010
hover,
11+
className,
1112
children,
1213
...rest
1314
}: ReactBadgeProps) => {
1415
const classes = classNames([
1516
styles.badge,
1617
theme && styles[theme],
17-
(onClick || hover) && styles.hover
18+
(onClick || hover) && styles.hover,
19+
className
1820
])
1921

2022
if (onClick) {

src/components/Badge/badge.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ export type BadgeProps = {
88
| 'alert'
99
| null
1010
hover?: boolean
11+
className?: string
12+
[key: string]: any
1113
}
1214

1315
export type SvelteBadgeProps = {

src/components/Button/Button.astro

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,15 @@ const {
1010
theme,
1111
bold,
1212
href,
13+
className,
1314
...rest
1415
} = Astro.props
1516
1617
const classes = classNames([
1718
styles.button,
1819
bold && styles.bold,
19-
theme && styles[theme]
20+
theme && styles[theme],
21+
className
2022
])
2123
---
2224

src/components/Button/Button.svelte

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,14 @@
77
export let theme: SvelteButtonProps['theme'] = null
88
export let bold: SvelteButtonProps['bold'] = false
99
export let href: SvelteButtonProps['href'] = ''
10+
export let className: SvelteButtonProps['className'] = ''
1011
export let onClick: SvelteButtonProps['onClick'] = () => {}
1112
1213
const classes = classNames([
1314
styles.button,
1415
bold && styles.bold,
15-
theme && styles[theme]
16+
theme && styles[theme],
17+
className
1618
])
1719
</script>
1820

src/components/Button/Button.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,16 @@ const Button = ({
88
theme,
99
bold,
1010
href,
11-
children,
11+
className,
1212
onClick,
13+
children,
1314
...rest
1415
}: ReactButtonProps) => {
1516
const classes = classNames([
1617
styles.button,
1718
bold && styles.bold,
18-
theme && styles[theme]
19+
theme && styles[theme],
20+
className
1921
])
2022

2123
if (href) {

src/components/Button/button.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ export type ButtonProps = {
99
| null
1010
bold?: boolean
1111
href?: string
12+
className?: string
1213
[key: string]: any
1314
}
1415

src/components/Card/Card.astro

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,6 @@ const Title = titleTag
2929
<Title class:list={styles.title}>{title}</Title>
3030
)}
3131
<div class:list={[styles.body, compact && styles.compact]}>
32-
{compact && !secondary ? (
33-
<div class={styles.wrapper}><slot /></div>
34-
) : (
35-
<slot />
36-
)}
32+
<slot />
3733
</div>
3834
</Component>

src/components/Card/Card.svelte

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,6 @@
3030
</svelte:element>
3131
{/if}
3232
<div class={bodyClasses}>
33-
{#if compact && !secondary}
34-
<div class={styles.wrapper}><slot /></div>
35-
{:else}
36-
<slot />
37-
{/if}
33+
<slot />
3834
</div>
3935
</svelte:element>

src/components/Card/Card.tsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,7 @@ const Card = ({
3131
<TitleTag className={styles.title}>{title}</TitleTag>
3232
)}
3333
<div className={bodyClasses}>
34-
{compact && !secondary
35-
? <div className={styles.wrapper}>{children}</div>
36-
: children
37-
}
34+
{children}
3835
</div>
3936
</Element>
4037
)

src/components/Card/card.module.scss

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,9 @@
2525
position: relative;
2626

2727
&.compact {
28-
background: #111;
28+
border: 20px solid #111;
29+
background: #000;
30+
padding: 40px;
2931
}
3032
}
31-
32-
.wrapper {
33-
background: #000;
34-
padding: 40px;
35-
height: 100%;
36-
}
3733
}

src/components/Checkbox/Checkbox.astro

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@ const {
1313
label,
1414
subText,
1515
disabled,
16-
boxed,
17-
color
16+
color,
17+
className
1818
} = Astro.props
1919
2020
const classes = [
2121
styles.checkbox,
22-
boxed && styles.boxed,
23-
label && subText && styles.col
22+
label && subText && styles.col,
23+
className
2424
]
2525
2626
const style = color

src/components/Checkbox/Checkbox.svelte

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@
1111
export let label: SvelteCheckboxProps['label'] = ''
1212
export let subText: SvelteCheckboxProps['subText'] = ''
1313
export let disabled: SvelteCheckboxProps['disabled'] = false
14-
export let boxed: SvelteCheckboxProps['boxed'] = false
1514
export let color: SvelteCheckboxProps['color'] = ''
15+
export let className: SvelteCheckboxProps['className'] = ''
1616
export let onClick: SvelteCheckboxProps['onClick'] = () => {}
1717
1818
const classes = classNames([
1919
styles.checkbox,
20-
boxed && styles.boxed,
21-
label && subText && styles.col
20+
label && subText && styles.col,
21+
className
2222
])
2323
2424
const style = color

src/components/Checkbox/Checkbox.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@ const Checkbox = ({
1212
label,
1313
subText,
1414
disabled,
15-
boxed,
1615
color,
16+
className,
1717
onClick
1818
}: ReactCheckboxProps) => {
1919
const classes = classNames([
2020
styles.checkbox,
21-
boxed && styles.boxed,
22-
label && subText && styles.col
21+
label && subText && styles.col,
22+
className
2323
])
2424

2525
const style = color

src/components/Checkbox/checkbox.module.scss

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,24 +6,22 @@
66
align-items: center;
77
gap: 10px;
88
font-size: 16px;
9+
line-height: 1.5;
910

1011
&.col {
1112
flex-direction: column;
1213
align-items: flex-start;
1314
justify-content: flex-start;
14-
gap: 5px;
15+
gap: 0;
1516

1617
.wrapper {
1718
display: flex;
18-
align-items: center;
1919
gap: 10px;
20-
}
21-
}
2220

23-
&.boxed {
24-
border: 1px solid #252525;
25-
border-radius: 5px;
26-
padding: 20px;
21+
.check {
22+
margin-top: 5px;
23+
}
24+
}
2725
}
2826

2927
input {
@@ -59,6 +57,7 @@
5957
display: inline-block;
6058
width: 15px;
6159
height: 15px;
60+
min-width: 15px;
6261
border: 1px solid var(--w-checkbox-color);
6362
border-radius: 2px;
6463
position: relative;

src/components/Checkbox/checkbox.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ export type CheckboxProps = {
33
label?: string
44
subText?: string
55
disabled?: boolean
6-
boxed?: boolean
76
color?: string
7+
className?: string
88
}
99

1010
export type SvelteCheckboxProps = {

src/components/ConditionalWrapper/ConditionalWrapper.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import type { ConditionalWrapperProps } from './conditionalwrapper'
33
44
export let condition: ConditionalWrapperProps['condition']
5-
export let element: string
5+
export let element: string = 'div'
66
</script>
77

88
{#if condition}

src/components/Input/Input.astro

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,31 +11,29 @@ const {
1111
theme,
1212
label,
1313
subText,
14-
fill,
1514
className,
1615
...rest
1716
} = Astro.props
1817
1918
const classes = [
2019
styles.input,
2120
theme && styles[theme],
22-
fill && styles.fill,
2321
className
2422
]
2523
26-
const useLabel = !!(label || subText || Astro.slots.has('icon'))
24+
const useLabel = !!(label || subText || Astro.slots.has('default'))
2725
---
2826

2927
<ConditionalWrapper condition={useLabel}>
3028
<label slot="wrapper" class={styles['input-label']}>
3129
{label && (
3230
<div class={styles.label}>{label}</div>
3331
)}
34-
<ConditionalWrapper condition={Astro.slots.has('icon')}>
32+
<ConditionalWrapper condition={Astro.slots.has('default')}>
3533
<div class={styles.wrapper} slot="wrapper">
3634
children
3735
</div>
38-
<slot name="icon" />
36+
<slot />
3937
children
4038
</ConditionalWrapper>
4139
{subText && (

src/components/Input/Input.svelte

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,17 @@
99
export let theme: SvelteInputProps['theme'] = null
1010
export let label: SvelteInputProps['label'] = ''
1111
export let subText: SvelteInputProps['subText'] = ''
12-
export let fill: SvelteInputProps['fill'] = false
1312
export let className: SvelteInputProps['className'] = ''
1413
export let onChange: SvelteInputProps['onChange'] = () => {}
1514
export let onKeyUp: SvelteInputProps['onKeyUp'] = () => {}
1615
1716
const classes = classNames([
1817
styles.input,
1918
theme && styles[theme],
20-
fill && styles.fill,
2119
className
2220
])
2321
24-
const useLabel = !!(label || subText || $$slots.icon)
22+
const useLabel = !!(label || subText || $$slots.default)
2523
</script>
2624

2725
<ConditionalWrapper
@@ -33,11 +31,11 @@
3331
<div class={styles.label}>{label}</div>
3432
{/if}
3533
<ConditionalWrapper
36-
condition={$$slots.icon}
34+
condition={$$slots.default}
3735
element="div"
3836
class={styles.wrapper}
3937
>
40-
<slot name="icon" />
38+
<slot />
4139
<input
4240
type={type}
4341
class={classes}

0 commit comments

Comments
 (0)