1
1
<script lang =" ts" >
2
2
import type { IconDefinition } from ' @fortawesome/fontawesome-common-types' ;
3
- import DropdownMenuItem from ' ./DropDownMenuItem.svelte' ;
4
3
import Fa from ' svelte-fa' ;
5
4
import { onMount } from ' svelte' ;
6
5
@@ -10,7 +9,6 @@ export let fontAwesomeIcon: IconDefinition | undefined = undefined;
10
9
export let hidden = false ;
11
10
export let enabled: boolean = true ;
12
11
export let onClick: () => void = () => {};
13
- export let menu = false ;
14
12
export let detailed = false ;
15
13
export let inProgress = false ;
16
14
export let iconOffset = ' ' ;
@@ -27,13 +25,13 @@ onMount(() => {
27
25
});
28
26
29
27
const buttonDetailedClass =
30
- ' text-gray-400 bg-charcoal-800 hover:text-violet-600 font-medium rounded-lg text-sm inline-flex items-center px-3 py-2 text-center' ;
28
+ ' text-[var(--pd-action-button-details-text)] bg-[var(--pd-action-button-details-bg)] hover:text-[var(--pd-action-button-details-hover-text)] font-medium rounded-lg text-sm inline-flex items-center px-3 py-2 text-center' ;
31
29
const buttonDetailedDisabledClass =
32
- ' text-gray-900 bg-charcoal-800 font-medium rounded-lg text-sm inline-flex items-center px-3 py-2 text-center' ;
30
+ ' text-[var(--pd-action-button-details-disabled-text)] bg-[var(--pd-action-button-details-disabled-bg)] font-medium rounded-lg text-sm inline-flex items-center px-3 py-2 text-center' ;
33
31
const buttonClass =
34
- ' m-0.5 text-gray-400 hover:bg-charcoal-600 hover:text-violet-600 font-medium rounded-full inline-flex items-center px-2 py-2 text-center' ;
32
+ ' text-[var(--pd-action-button-text)] hover:bg-[var(--pd-action-button-hover-bg)] hover:text-[var(--pd-action-button-hover-text)] font-medium rounded-full inline-flex items-center px-2 py-2 text-center' ;
35
33
const buttonDisabledClass =
36
- ' m-0.5 text-gray-900 font-medium rounded-full inline-flex items-center px-2 py-2 text-center' ;
34
+ ' text-[var(--pd-action-button-disabled-text)] font-medium rounded-full inline-flex items-center px-2 py-2 text-center' ;
37
35
38
36
$ : styleClass = detailed
39
37
? enabled && ! inProgress
@@ -45,27 +43,22 @@ $: styleClass = detailed
45
43
</script >
46
44
47
45
<!-- If menu = true, use the menu, otherwise implement the button -->
48
- {#if menu }
49
- <!-- enabled menu -->
50
- <DropdownMenuItem title ={title } icon ={icon } enabled ={enabled } hidden ={hidden } onClick ={onClick } />
51
- {:else }
52
- <!-- enabled button -->
53
- <button
54
- title ={title }
55
- aria-label ={title }
56
- on:click ={onClick }
57
- class =" {styleClass } relative"
58
- class:disabled ={inProgress }
59
- class:hidden ={hidden }
60
- disabled ={! enabled }>
61
- {#if fontAwesomeIcon }
62
- <Fa class ="h-4 w-4 {iconOffset }" icon ={fontAwesomeIcon } />
63
- {/if }
46
+ <!-- enabled button -->
47
+ <button
48
+ title ={title }
49
+ aria-label ={title }
50
+ on:click ={onClick }
51
+ class =" {styleClass } relative"
52
+ class:disabled ={inProgress }
53
+ class:hidden ={hidden }
54
+ disabled ={! enabled }>
55
+ {#if fontAwesomeIcon }
56
+ <Fa class ="h-4 w-4 {iconOffset }" icon ={fontAwesomeIcon } />
57
+ {/if }
64
58
65
- <div
66
- aria-label =" spinner"
67
- class ="w-6 h-6 rounded-full animate-spin border border-solid border-violet-500 border-t-transparent absolute {positionTopClass } {positionLeftClass }"
68
- class:hidden ={! inProgress }>
69
- </div >
70
- </button >
71
- {/if }
59
+ <div
60
+ aria-label =" spinner"
61
+ class ="w-6 h-6 rounded-full animate-spin border border-solid border-[var(--pd-action-button-spinner)] border-t-transparent absolute {positionTopClass } {positionLeftClass }"
62
+ class:hidden ={! inProgress }>
63
+ </div >
64
+ </button >
0 commit comments