Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate component to Svelte CustomElement API #1

Merged
merged 32 commits into from
May 18, 2021
Merged
Changes from 1 commit
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
5c815d9
Add svelte, esbuilt, windi and test with social sharer
Th1nkK1D May 7, 2021
a41ff35
Add storybook for svelte
Th1nkK1D May 7, 2021
f9ff0c7
Migrate staging banner to svelte
Th1nkK1D May 7, 2021
29c04dd
Migrate navigation bar to svelte
Th1nkK1D May 7, 2021
ff4e91a
Migrate footer to svelte
Th1nkK1D May 7, 2021
3c1de5e
Refactor windi selector
Th1nkK1D May 7, 2021
320c1b7
Handle empty selector in stylesheet transformation
Th1nkK1D May 7, 2021
e14f496
Update style parser to support recursive rules
Th1nkK1D May 10, 2021
1f9a686
Fox missing tw class by building component seperately
Th1nkK1D May 10, 2021
089234e
Rename component with elect prefix
Th1nkK1D May 10, 2021
b08ef28
Remove unused dependencies
Th1nkK1D May 10, 2021
d38366f
Restructure source and build path
Th1nkK1D May 10, 2021
b9b0cf8
Update gitignore
Th1nkK1D May 10, 2021
6ff15f1
Update assets built path
Th1nkK1D May 10, 2021
01ea5b8
Fix global style by building component seperately
Th1nkK1D May 13, 2021
77d31b3
Rename prop since Svelte have issue with kebab
Th1nkK1D May 13, 2021
f0690d2
Update hygen template
Th1nkK1D May 13, 2021
da863c0
Fix storybook theme
Th1nkK1D May 13, 2021
f7dea92
Update document for svelte
Th1nkK1D May 13, 2021
2c19278
Remove unused index.ts
Th1nkK1D May 17, 2021
3e83b5d
Revert "Rename prop since Svelte have issue with kebab"
Th1nkK1D May 17, 2021
cc9ec65
Remove console log
Th1nkK1D May 17, 2021
f5fd008
Fix navbar mobile layout
Th1nkK1D May 17, 2021
5097cc2
Add custom element wrapper for dash props
Th1nkK1D May 17, 2021
1d9690b
Update documentation
Th1nkK1D May 17, 2021
8adefc2
Windi svelte preprocess 4 support custom element
Th1nkK1D May 18, 2021
059ca60
Parse custom element omitted value
Th1nkK1D May 18, 2021
92e8355
Use esbuild to minify typography.css
Th1nkK1D May 18, 2021
ba36e9a
Add index entry point
Th1nkK1D May 18, 2021
e1c3f1f
Fix windi upgrade on storybook
Th1nkK1D May 18, 2021
acddde9
Update storybook theme
Th1nkK1D May 18, 2021
bdd0ec0
Add doc about polyfill
Th1nkK1D May 18, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add storybook for svelte
  • Loading branch information
Th1nkK1D committed May 7, 2021
commit a41ff359266d3ce0323b522c3ee8eba41a8c9805
12 changes: 9 additions & 3 deletions .storybook/main.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
const sveltePreprocess = require('svelte-preprocess');
const svelteWindi = require('svelte-windicss-preprocess');

module.exports = {
stories: [
'../components/**/*.stories.@(js|jsx|ts|tsx)',
'../docs/**/*.stories.mdx',
'../stories/**/*.stories.mdx',
'../stories/**/*.stories.@(js|jsx|ts|tsx|svelte)',
],
addons: [
'@storybook/addon-links',
'@storybook/addon-essentials',
'@storybook/addon-a11y',
'@storybook/addon-svelte-csf',
],
svelteOptions: {
preprocess: [sveltePreprocess(), svelteWindi.preprocess()],
},
};
6 changes: 6 additions & 0 deletions .storybook/preview.js
Original file line number Diff line number Diff line change
@@ -7,4 +7,10 @@ export const parameters = {
locales: '',
},
},
controls: {
matchers: {
color: /(background|color)$/i,
date: /Date$/,
},
},
};
File renamed without changes.
109 changes: 0 additions & 109 deletions components/social-sharer/index.ts

This file was deleted.

36 changes: 0 additions & 36 deletions components/social-sharer/social-sharer.stories.js

This file was deleted.

3 changes: 0 additions & 3 deletions esbuild.mjs
Original file line number Diff line number Diff line change
@@ -45,9 +45,6 @@ const transformStyleForWebComponent = {
esbuildSvelte({
preprocess: [
windiCss({
config: 'windi.config.ts',
// compile: true,
prefix: 'wd-',
mode: 'prod',
}),
sveltePreprocess(),
16 changes: 8 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
@@ -20,14 +20,13 @@
"twind": "^0.15.4"
},
"devDependencies": {
"@babel/core": "^7.13.1",
"@storybook/addon-a11y": "^6.1.21",
"@storybook/addon-actions": "^6.1.21",
"@storybook/addon-essentials": "^6.1.19",
"@storybook/addon-links": "^6.1.19",
"@storybook/addons": "^6.1.21",
"@storybook/html": "^6.1.19",
"@storybook/theming": "^6.1.21",
"@babel/core": "^7.14.0",
"@storybook/addon-actions": "^6.2.9",
"@storybook/addon-essentials": "^6.2.9",
"@storybook/addon-links": "^6.2.9",
"@storybook/addon-svelte-csf": "^1.0.0",
"@storybook/svelte": "^6.2.9",
"@storybook/theming": "^6.2.9",
"@typescript-eslint/eslint-plugin": "^4.16.1",
"@typescript-eslint/parser": "^4.16.1",
"babel-loader": "^8.2.2",
@@ -45,6 +44,7 @@
"postcss-cli": "^8.3.1",
"prettier": "^2.2.1",
"svelte": "^3.38.2",
"svelte-loader": "^3.1.1",
"svelte-preprocess": "^4.7.3",
"svelte-windicss-preprocess": "^3.5.3",
"tiny-glob": "^0.2.8",
34 changes: 34 additions & 0 deletions stories/components/social-sharer.stories.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<script>
import { Meta, Template, Story } from '@storybook/addon-svelte-csf';
import SocialSharer from '../../components/social-sharer.svelte';
</script>

<Meta
title="Components/social-sharer"
component={SocialSharer}
argTypes={{
url: { control: 'text' },
light: { control: 'boolean' },
hideLabel: { control: 'boolean' },
vertical: { control: 'boolean' },
}}
/>

<Template let:args>
<SocialSharer {...args} />
</Template>

<Story
name="Primary"
args={{
url: 'https://elect.in.th',
}}
/>

<Story
name="Vertical"
args={{
url: 'https://elect.in.th',
vertical: true,
}}
/>
File renamed without changes.
File renamed without changes.
File renamed without changes.