File tree Expand file tree Collapse file tree 2 files changed +21
-17
lines changed Expand file tree Collapse file tree 2 files changed +21
-17
lines changed Original file line number Diff line number Diff line change 1
1
declare module '@eliancodes/brutal-ui' {
2
2
type ButtonProps = {
3
3
href : string ;
4
- target : '_blank' | '_self' ;
5
- color : string ;
6
- string : string ;
4
+ target ?: '_blank' | '_self' ;
5
+ color ?: string ;
7
6
}
8
7
9
8
export function Button ( props : ButtonProps ) : any ;
Original file line number Diff line number Diff line change 1
1
---
2
2
interface Props {
3
3
href: string ;
4
- target: ' _blank' | ' _self' ;
5
- color: string ;
6
- string: string ;
4
+ target? : ' _blank' | ' _self' ;
5
+ color? : string ;
7
6
}
8
7
9
- const colors = await Astro .glob (' ../config/colors.json' )
8
+ import colors from ' ../config/colors.json' ;
9
+
10
+ if (Astro .props .target === undefined ) {
11
+ Astro .props .target = ' _self' ;
12
+ }
13
+
14
+ if (Astro .props .color === undefined ) {
15
+ Astro .props .color = colors .colors [Math .floor (Math .random () * colors .colors .length )];
16
+ ;
17
+ }
10
18
11
19
const { href, target, color } = Astro .props ;
20
+
12
21
---
13
- <style >
14
- a.btn {
22
+ <style define:vars = { { color: color } } >
23
+ a.brutal- btn {
15
24
filter: drop-shadow(5px 5px 0 rgb(0 0 0 / 1));
25
+ background-color: white;
16
26
}
17
- a.btn:hover {
27
+ a.brutal- btn:hover {
18
28
filter: drop-shadow(3px 3px 0 rgb(0 0 0 / 1));
29
+ background-color: var(--color);
19
30
}
20
31
</style >
21
32
22
33
<a
23
34
href ={ href }
24
35
target ={ target }
25
- class:list ={ [
26
- color
27
- ? ` hover:bg-${color } `
28
- : ` hover:bg-${colors [Math .floor (Math .random () * colors .length )]} ` ,
29
- ' btn bg-white sanchez inline-block py-2 px-4 border-2 border-black transition-all ease-in-out duration-150' ,
30
- ]}
36
+ class =" brutal-btn sanchez inline-block py-2 px-4 border-2 border-black transition-all ease-in-out duration-150"
31
37
>
32
- test
33
38
<slot />
34
39
</a >
You can’t perform that action at this time.
0 commit comments