-
-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
46 changed files
with
3,399 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,3 +11,8 @@ vite.config.js.timestamp-* | |
vite.config.ts.timestamp-* | ||
|
||
$houdini | ||
|
||
# Paraglide | ||
src/lib/paraglide | ||
|
||
*storybook.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import type { StorybookConfig } from '@storybook/sveltekit'; | ||
|
||
const config: StorybookConfig = { | ||
stories: ['../src/**/*.mdx', '../src/**/*.stories.@(js|ts|svelte)'], | ||
addons: [ | ||
'@storybook/addon-svelte-csf', | ||
'@storybook/addon-essentials', | ||
'@chromatic-com/storybook', | ||
'@storybook/addon-interactions' | ||
], | ||
framework: { | ||
name: '@storybook/sveltekit', | ||
options: {} | ||
} | ||
}; | ||
export default config; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import type { Preview } from '@storybook/svelte'; | ||
|
||
import '../src/app.css'; | ||
|
||
const preview: Preview = { | ||
parameters: { | ||
controls: { | ||
matchers: { | ||
color: /(background|color)$/i, | ||
date: /Date$/i | ||
} | ||
} | ||
} | ||
}; | ||
|
||
export default preview; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"$schema": "https://inlang.com/schema/inlang-message-format", | ||
"hello_world": "Hello, {name} from en!" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
cache |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
6f9f64b72ff4fdf2638086d1a8e0562fce1876cf41c1a0599dbd8306fe1a32dc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"$schema": "https://inlang.com/schema/project-settings", | ||
"modules": [ | ||
"https://cdn.jsdelivr.net/npm/@inlang/message-lint-rule-empty-pattern@1/dist/index.js", | ||
"https://cdn.jsdelivr.net/npm/@inlang/message-lint-rule-identical-pattern@1/dist/index.js", | ||
"https://cdn.jsdelivr.net/npm/@inlang/message-lint-rule-missing-translation@1/dist/index.js", | ||
"https://cdn.jsdelivr.net/npm/@inlang/message-lint-rule-without-source@1/dist/index.js", | ||
"https://cdn.jsdelivr.net/npm/@inlang/message-lint-rule-valid-js-identifier@1/dist/index.js", | ||
"https://cdn.jsdelivr.net/npm/@inlang/plugin-message-format@2/dist/index.js", | ||
"https://cdn.jsdelivr.net/npm/@inlang/plugin-m-function-matcher@0/dist/index.js" | ||
], | ||
"plugin.inlang.messageFormat": { | ||
"pathPattern": "./messages/{languageTag}.json" | ||
}, | ||
"sourceLanguageTag": "en", | ||
"languageTags": ["en"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import { i18n } from '$lib/i18n'; | ||
import type { Handle } from '@sveltejs/kit'; | ||
|
||
const handleParaglide: Handle = i18n.handle(); | ||
export const handle: Handle = handleParaglide; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import { i18n } from '$lib/i18n'; | ||
|
||
export const reroute = i18n.reroute(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import * as runtime from '$lib/paraglide/runtime'; | ||
import { createI18n } from '@inlang/paraglide-sveltekit'; | ||
|
||
export const i18n = createI18n(runtime); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<a href="/demo/paraglide">paraglide</a> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<script lang="ts"> | ||
import { goto } from '$app/navigation'; | ||
import { page } from '$app/state'; | ||
import { i18n } from '$lib/i18n'; | ||
import * as m from '$lib/paraglide/messages.js'; | ||
import type { AvailableLanguageTag } from '$lib/paraglide/runtime'; | ||
function switchToLanguage(newLanguage: AvailableLanguageTag) { | ||
const canonicalPath = i18n.route(page.url.pathname); | ||
const localisedPath = i18n.resolveRoute(canonicalPath, newLanguage); | ||
goto(localisedPath); | ||
} | ||
</script> | ||
|
||
<h1>{m.hello_world({ name: 'SvelteKit User' })}</h1> | ||
<div> | ||
<button onclick={() => switchToLanguage('en')}>en</button> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<script module> | ||
import { defineMeta } from '@storybook/addon-svelte-csf'; | ||
import { fn } from '@storybook/test'; | ||
import Button from './Button.svelte'; | ||
// More on how to set up stories at: https://storybook.js.org/docs/writing-stories | ||
const { Story } = defineMeta({ | ||
title: 'Example/Button', | ||
component: Button, | ||
tags: ['autodocs'], | ||
argTypes: { | ||
backgroundColor: { control: 'color' }, | ||
size: { | ||
control: { type: 'select' }, | ||
options: ['small', 'medium', 'large'] | ||
} | ||
}, | ||
args: { | ||
onClick: fn() | ||
} | ||
}); | ||
</script> | ||
|
||
<!-- More on writing stories with args: https://storybook.js.org/docs/writing-stories/args --> | ||
<Story name="Primary" args={{ primary: true, label: 'Button' }} /> | ||
|
||
<Story name="Secondary" args={{ label: 'Button' }} /> | ||
|
||
<Story name="Large" args={{ size: 'large', label: 'Button' }} /> | ||
|
||
<Story name="Small" args={{ size: 'small', label: 'Button' }} /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<script lang="ts"> | ||
import './button.css'; | ||
interface Props { | ||
/** Is this the principal call to action on the page? */ | ||
primary?: boolean; | ||
/** What background color to use */ | ||
backgroundColor?: string; | ||
/** How large should the button be? */ | ||
size?: 'small' | 'medium' | 'large'; | ||
/** Button contents */ | ||
label: string; | ||
/** The onclick event handler */ | ||
onClick?: () => void; | ||
} | ||
const { primary = false, backgroundColor, size = 'medium', label, onClick }: Props = $props(); | ||
</script> | ||
|
||
<button | ||
type="button" | ||
class={['storybook-button', `storybook-button--${size}`].join(' ')} | ||
class:storybook-button--primary={primary} | ||
class:storybook-button--secondary={!primary} | ||
style:background-color={backgroundColor} | ||
onclick={onClick} | ||
> | ||
{label} | ||
</button> |
Oops, something went wrong.