Skip to content

Commit fae5c3f

Browse files
committed
Rename prop since Svelte have issue with kebab
# sveltejs/svelte#3852
1 parent 44f6189 commit fae5c3f

File tree

8 files changed

+31
-25
lines changed

8 files changed

+31
-25
lines changed

.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -108,5 +108,5 @@ storybook-static
108108
pnpm-lock.yaml
109109

110110
# Built files
111-
components
111+
components/*.js
112112
assets

example/index.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
<body>
1616
<elect-staging-banner></elect-staging-banner>
17-
<elect-navbar></elect-navbar>
17+
<elect-navbar title="Some Project"></elect-navbar>
1818
<elect-sharer></elect-sharer>
1919
<elect-footer></elect-footer>
2020
</body>

src/components/navbar/navbar.stories.svelte

+6-5
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
11
<script>
22
import { Meta, Template, Story } from '@storybook/addon-svelte-csf';
33
import NavigationBar from './navbar.wc.svelte';
4+
45
</script>
56

67
<Meta
78
title="Components/navbar"
89
component={NavigationBar}
910
argTypes={{
10-
titleText: { control: 'text' },
11+
title: { control: 'text' },
1112
dark: { control: 'boolean' },
12-
logoUrl: { control: 'text' },
13-
showSlotInNewRowOnMobile: { control: 'boolean' },
13+
logo: { control: 'text' },
14+
mobilenewlineslot: { control: 'boolean' },
1415
}}
1516
/>
1617

@@ -25,13 +26,13 @@
2526
<Story
2627
name="With Title"
2728
args={{
28-
titleText: 'CIVIL MOVEMENT 2020',
29+
title: 'CIVIL MOVEMENT 2020',
2930
}}
3031
/>
3132

3233
<Story
3334
name="Custom Logo"
3435
args={{
35-
logoUrl: 'https://via.placeholder.com/100x20',
36+
logo: 'https://via.placeholder.com/100x20',
3637
}}
3738
/>

src/components/navbar/navbar.wc.svelte

+11-10
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,22 @@
11
<svelte:options tag="elect-navbar" />
22

33
<script lang="ts">
4-
export let titleText: string = '';
4+
export let title: string = '';
55
export let dark: boolean = false;
6-
export let logoUrl: string = '';
7-
export let showSlotInNewRowOnMobile: boolean = false;
6+
export let logo: string = '';
7+
export let mobilenewlineslot: boolean = false;
8+
89
</script>
910

1011
<div
11-
class="flex bg-white {showSlotInNewRowOnMobile
12-
? 'flex-col md:flex-row'
12+
class="flex bg-white md:flex-row {mobilenewlineslot
13+
? 'flex-col'
1314
: 'flex-row'} {dark ? 'bg-black' : 'bg-white'}"
1415
>
1516
<div class="flex my-auto p-3 h-10 md:(flex-1 h-12)">
1617
<a href="./" class="h-4 md:h-5 my-auto">
17-
{#if logoUrl}
18-
<img src={logoUrl} alt="ELECT" class="h-4 md:h-5" />
18+
{#if logo}
19+
<img src={logo} alt="ELECT" class="h-4 md:h-5" />
1920
{:else}
2021
<svg
2122
class="h-4 md:h-5 {dark ? 'text-white' : 'text-black'}"
@@ -55,16 +56,16 @@
5556
{/if}
5657
</a>
5758
</div>
58-
{#if titleText}
59+
{#if title}
5960
<div class="hidden md:flex">
6061
<a href="./" class="my-auto flex font-heading text-lg md:text-xl">
61-
<span class={dark ? 'text-white' : 'text-black'}>{titleText}</span>
62+
<span class={dark ? 'text-white' : 'text-black'}>{title}</span>
6263
</a>
6364
</div>
6465
{/if}
6566

6667
<div
67-
class="flex-1 flex {showSlotInNewRowOnMobile
68+
class="flex-1 flex {mobilenewlineslot
6869
? 'md:(justify-end pr-3)'
6970
: 'justify-end pr-3'}"
7071
>

src/components/sharer/sharer.stories.svelte

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<script>
22
import { Meta, Template, Story } from '@storybook/addon-svelte-csf';
33
import SocialSharer from './sharer.wc.svelte';
4+
45
</script>
56

67
<Meta
@@ -9,7 +10,7 @@
910
argTypes={{
1011
url: { control: 'text' },
1112
light: { control: 'boolean' },
12-
hideLabel: { control: 'boolean' },
13+
hidelabel: { control: 'boolean' },
1314
vertical: { control: 'boolean' },
1415
}}
1516
/>

src/components/sharer/sharer.wc.svelte

+3-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<script lang="ts">
44
export let url: string = '';
55
export let light: boolean = false;
6-
export let hideLabel: boolean = false;
6+
export let hidelabel: boolean = false;
77
export let vertical: boolean = false;
88
99
$: encodedUrl = encodeURI(url || window.location.href);
@@ -58,6 +58,7 @@
5858
`,
5959
},
6060
];
61+
6162
</script>
6263

6364
<div
@@ -66,7 +67,7 @@
6667
: 'flex-row space-x-4'}"
6768
class:text-white={light}
6869
>
69-
{#if !hideLabel}
70+
{#if !hidelabel}
7071
<div class="flex text-sm">
7172
<span class:m-auto={!vertical}>Share</span>
7273
</div>

src/components/staging-banner/staging-banner.stories.svelte

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
<script>
22
import { Meta, Template, Story } from '@storybook/addon-svelte-csf';
33
import StagingBanner from './staging-banner.wc.svelte';
4+
45
</script>
56

67
<Meta
78
title="Components/staging-banner"
89
component={StagingBanner}
910
argTypes={{
10-
productionUrl: { control: 'text' },
11+
productionurl: { control: 'text' },
1112
}}
1213
/>
1314

@@ -18,6 +19,6 @@
1819
<Story
1920
name="Primary"
2021
args={{
21-
productionUrl: '',
22+
productionurl: '',
2223
}}
2324
/>

src/components/staging-banner/staging-banner.wc.svelte

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
<svelte:options tag="elect-staging-banner" />
22

33
<script lang="ts">
4-
let productionUrl: string = '';
4+
let productionurl: string = '';
5+
56
</script>
67

78
<div class="bg-gray-600 text-white text-xs font-body px-4 py-2">
@@ -26,10 +27,10 @@
2627
<strong>คำเตือน</strong>
2728
เว็บไซต์นี้มีจุดประสงค์ในการทดสอบภายในทีม ELECT เท่านั้น อาจมีข้อมูลและการทำงานที่ไม่ถูกต้อง
2829
ทางทีมงานจะไม่รับผิดชอบข้อผิดพลาดใด ๆ ที่เกิดขึ้น
29-
{#if productionUrl}
30+
{#if productionurl}
3031
ท่านสามารถชมชิ้นงานจริงได้
3132
<a
32-
href="${productionUrl}"
33+
href="${productionurl}"
3334
target="_blank"
3435
rel="noopener noreferrer"
3536
class="underline"

0 commit comments

Comments
 (0)