File tree 3 files changed +25
-6
lines changed
components/custom/StaticChip
3 files changed +25
-6
lines changed Original file line number Diff line number Diff line change 1
1
<script >
2
2
/** @type {string} the background color of the chip */
3
3
export let bgColor = ' #e5e5e5'
4
+ /** @type {string} sets the height of the component not including margin*/
5
+ export let height = ' 36px'
4
6
</script >
5
7
6
8
<style >
7
9
.chip {
8
10
background-color : var (--theme-color );
9
- height : 36px ;
11
+ height : var (--theme-height );
12
+ display : inline-flex ;
10
13
}
11
14
12
15
.chip-content {
16
+ display : flex ;
13
17
padding-left : 12px ;
14
18
padding-right : 12px ;
19
+ vertical-align : middle ;
20
+ align-items : center ;
21
+ font-size : 14px ;
15
22
}
16
23
</style >
17
24
18
25
<div
19
- class ="mdc-typography chip black flex justify-center align-items-center mb-1 mr-2 fs-14 br-16px {$$props .class || ' ' }"
20
- style ="--theme-color: {bgColor }"
26
+ class ="mdc-typography chip br-16px {$$props .class || ' ' }"
27
+ style ="--theme-color: {bgColor }; --theme-height: { height } "
21
28
>
22
- <div class =" chip-content flex align-items-center " >
29
+ <div class =" chip-content" >
23
30
<slot />
24
31
</div >
25
32
</div >
Original file line number Diff line number Diff line change @@ -375,6 +375,7 @@ declare module '@silintl/ui-components' {
375
375
376
376
interface StaticChipProps {
377
377
bgColor ?: string
378
+ height ?: string
378
379
class ?: string
379
380
}
380
381
export class StaticChip extends SvelteComponentTyped < StaticChipProps > { }
Original file line number Diff line number Diff line change 1
1
<script >
2
- import { Meta , Template , Story } from ' @storybook/addon-svelte-csf '
2
+ import { copyAndModifyArgs } from ' ./helpers.js '
3
3
import { StaticChip } from ' ../components/custom'
4
+ import { Meta , Template , Story } from ' @storybook/addon-svelte-csf'
4
5
5
6
const args = {
6
7
class: ' ' , // only works for global classes
8
+ bgColor: ' #e5e5e5' ,
9
+ height: ' 36px' ,
7
10
}
11
+
12
+ const chips = [' chip 1' , ' CHIP TWO' , ' chip three is longer...................' ]
8
13
</script >
9
14
10
15
<Meta title ="Atoms/StaticChip" component ={StaticChip } />
11
16
12
17
<Template let:args >
13
- <StaticChip {...args }>A Chip</StaticChip >
18
+ <div >
19
+ {#each chips as chip }
20
+ <StaticChip {...args }>{chip }</StaticChip >
21
+ {/each }
22
+ </div >
14
23
</Template >
15
24
16
25
<Story name ="Default" {args } />
26
+ <Story name ="bgColor" args ={copyAndModifyArgs (args , { bgColor: ' green' })} />
27
+ <Story name ="height" args ={copyAndModifyArgs (args , { height: ' 28px' })} />
You can’t perform that action at this time.
0 commit comments