File tree Expand file tree Collapse file tree 8 files changed +61
-35
lines changed Expand file tree Collapse file tree 8 files changed +61
-35
lines changed Original file line number Diff line number Diff line change 1
1
<script lang =" ts" >
2
+ import ToolTip from ' ./ToolTip.svelte' ;
3
+
2
4
export let type: ' filled' | ' tonal' | ' text' | ' outlined' | ' icon' = ' filled' ;
3
5
export let variant: ' default' | ' danger' | ' onDangerBackground' = ' default' ;
4
6
export let functionType: typeof HTMLButtonElement .prototype .type = ' button' ;
9
11
export let target: string = ' ' ;
10
12
export let label: string = ' ' ;
11
13
export let disabled: boolean = false ;
14
+ export let toolTipText: string | undefined = undefined ;
12
15
13
16
$ : type = $$slots .default ? type : ' icon' ;
14
17
</script >
15
18
16
- {#if href }
17
- <a {href } {target } aria-label ={label } class ={` ${type } ${variant } ` } class:disabled >
18
- <svelte:component this ={icon } size ={iconSize } color ={iconColor } />
19
- <slot />
20
- </a >
21
- {:else }
22
- <button
23
- on:click
24
- class ={` ${type } ${variant } ` }
25
- class:disabled
26
- aria-label ={label }
27
- type ={functionType }
28
- {disabled }
29
- >
30
- <svelte:component this ={icon } size ={iconSize } color ={iconColor } />
31
- <slot />
32
- </button >
33
- {/if }
19
+ <ToolTip content ={toolTipText } html ={false }>
20
+ {#if href }
21
+ <a {href } {target } aria-label ={label } class ={` ${type } ${variant } ` } class:disabled >
22
+ <svelte:component this ={icon } size ={iconSize } color ={iconColor } />
23
+ <slot />
24
+ </a >
25
+ {:else }
26
+ <button
27
+ on:click
28
+ class ={` ${type } ${variant } ` }
29
+ class:disabled
30
+ aria-label ={label }
31
+ type ={functionType }
32
+ {disabled }
33
+ >
34
+ <svelte:component this ={icon } size ={iconSize } color ={iconColor } />
35
+ <slot />
36
+ </button >
37
+ {/if }
38
+ </ToolTip >
34
39
35
40
<style lang =" scss" >
36
41
a ,
Original file line number Diff line number Diff line change 2
2
import { tooltip } from ' svooltip' ;
3
3
import ' ../styles/ToolTip.scss' ;
4
4
5
- export let content: string ;
5
+ export let content: string | undefined ;
6
6
export let html: boolean = false ;
7
7
</script >
8
8
9
- <div
10
- use:tooltip ={{
11
- content : content ,
12
- html : html
13
- }}
14
- >
9
+ {#if content }
10
+ <div
11
+ use:tooltip ={{
12
+ content : content ,
13
+ html : html
14
+ }}
15
+ >
16
+ <slot />
17
+ </div >
18
+ {:else }
15
19
<slot />
16
- </ div >
20
+ { /if }
17
21
18
22
<style >
19
23
:root {
Original file line number Diff line number Diff line change 87
87
</div >
88
88
<main class ="wrapper" in:fly ={{ y : 10 , easing : quintOut , duration : 750 }}>
89
89
<Query query ={tagsQuery } let:data >
90
- <TagsHost tags ={data .tags } />
90
+ <TagsHost tags ={data .tags } expandable ={ true } />
91
91
</Query >
92
92
93
93
<Query {query } let:data >
110
110
on:keypress ={() => (expanded = ! expanded )}
111
111
tabindex =" 0"
112
112
>
113
- <h4 >Archived announcements </h4 >
113
+ <h4 >Archive </h4 >
114
114
115
115
<div id ="arrow" style:transform ={expanded ? ' rotate(-180deg)' : ' rotate(0deg)' }>
116
116
<ChevronDown size =" 24px" color =" var(--surface-six)" />
Original file line number Diff line number Diff line change 26
26
27
27
gap : 8px ;
28
28
height : 32px ;
29
- padding : 0 16 px ;
29
+ padding : 0 12 px ;
30
30
31
31
border-radius : 8px ;
32
32
border : none ;
Original file line number Diff line number Diff line change 67
67
div {
68
68
display : flex ;
69
69
align-items : center ;
70
+ flex-wrap : wrap ;
71
+ white-space : nowrap ;
70
72
gap : 4px ;
71
73
72
74
li {
Original file line number Diff line number Diff line change 1
1
<script lang =" ts" >
2
- import Footer from ' $layout/Footer/FooterHost.svelte' ;
3
2
import { fly } from ' svelte/transition' ;
4
3
import { quintOut } from ' svelte/easing' ;
5
4
import { createQuery } from ' @tanstack/svelte-query' ;
46
45
{:else }
47
46
<Announcement {isCreating } {announcement } {announcementIdNumber } />
48
47
{/if }
49
- </main >
50
-
51
- <Footer />
48
+ </main >
Original file line number Diff line number Diff line change 109
109
<div >
110
110
{#if isEditing || isCreating }
111
111
<Button
112
+ toolTipText ={isPreviewing ? ' Hide preview' : ' Show preview' }
112
113
icon ={isPreviewing ? Hide : Show }
113
114
iconColor =" var(--secondary)"
114
115
on:click ={() => (isPreviewing = ! isPreviewing )}
115
116
/>
117
+
116
118
<Button
119
+ toolTipText ={archivedAtInput ? ' Disable archive field' : ' Enable archive field' }
117
120
icon ={archivedAtInput ? Unarchive : Archive }
118
121
iconColor =" var(--secondary)"
119
122
on:click ={toggleArchived }
120
123
/>
124
+
121
125
{#if isEditing }
122
126
<Button
127
+ toolTipText =" Cancel editing"
123
128
icon ={Close }
124
129
iconColor =" var(--secondary)"
125
130
on:click ={() => {
128
133
}}
129
134
/>
130
135
{/if }
136
+
131
137
<Button
138
+ toolTipText ={isEditing ? ' Save changes' : ' Create announcement' }
132
139
icon ={Check }
133
140
iconColor =" var(--secondary)"
134
141
on:click ={isEditing ? save : createAnnouncement }
135
142
/>
136
143
{:else }
137
144
<Button
145
+ toolTipText =" Delete announcement"
138
146
icon ={Delete }
139
147
iconColor =" var(--secondary)"
140
148
on:click ={() => (showDeleteConfirm = ! showDeleteConfirm )}
141
149
/>
142
- <Button icon ={Edit } iconColor ="var(--secondary)" on:click ={() => (isEditing = ! isEditing )} />
150
+
151
+ <Button
152
+ toolTipText =" Edit announcement"
153
+ icon ={Edit }
154
+ iconColor =" var(--secondary)"
155
+ on:click ={() => (isEditing = ! isEditing )}
156
+ />
143
157
{/if }
144
158
</div >
145
159
Original file line number Diff line number Diff line change 18
18
}
19
19
20
20
$ : displayCreatedAt = isPreviewing ? createdAtInput : createdAt ;
21
- $ : displayArchivedAt = isPreviewing ? archivedAtInput : archivedAt ;
21
+
22
+ $ : displayArchivedAt = (() => {
23
+ const date = isPreviewing ? archivedAtInput : archivedAt ;
24
+ return date && moment (date ).isBefore () ? date : null ;
25
+ })();
22
26
</script >
23
27
24
28
{#if (isEditing || isCreating ) && ! isPreviewing }
You can’t perform that action at this time.
0 commit comments