Skip to content

Commit

Permalink
docs: fix examples
Browse files Browse the repository at this point in the history
  • Loading branch information
azat-io committed Dec 3, 2024
1 parent 8407bae commit 35a70c4
Show file tree
Hide file tree
Showing 5 changed files with 139 additions and 134 deletions.
273 changes: 139 additions & 134 deletions docs/components/Demo/DemoBlock.astro
Original file line number Diff line number Diff line change
@@ -1,143 +1,148 @@
---
import { dedent } from 'ts-dedent'
import CodeExample from '../CodeExample.svelte'
import Typography from '../Typography.astro'
import Container from '../Container.astro'
import Title from '../Title.astro'
let initial = `import Button from '~/components/Button'
import type { FC } from 'react'
import {
useId,
useCallback,
useState,
useEffect,
} from 'react'
import Form from '~/component/Form'
import './style.css'
import Input from '~/components/Input'
import { FormValues } from '~/stores/auth'
interface Props {
className?: string
onSubmit: (values: FormValues) => void
id: string
resetFormValues: () => void
title: string
}
const Auth: FC<Props> => (props) => (
<Form {...props}>
<Input
placeholder="Enter your email"
full
name="user-email"
validation={/^[^s@]+@[^s@]+.[^s@]+$/i}
type="email"
label="Email address"
/>
<Button
type="submit"
className="submit-button"
size="l"
color="secondary"
>
Submit
</Button>
</Form>
)`
let alphabetical = `import type { FC } from 'react'
import {
useCallback,
useEffect,
useId,
useState,
} from 'react'
import Button from '~/components/Button'
import Form from '~/component/Form'
import Input from '~/components/Input'
import { FormValues } from '~/stores/auth'
import './style.css'
interface Props {
className?: string
id: string
onSubmit: (values: FormValues) => void
resetFormValues: () => void
title: string
}
const Auth: FC<Props> => (props) => (
<Form {...props}>
<Input
full
label="Email address"
name="user-email"
placeholder="Enter your email"
type="email"
validation={/^[^s@]+@[^s@]+.[^s@]+$/i}
/>
<Button
className="submit-button"
color="secondary"
size="l"
type="submit"
>
Submit
</Button>
</Form>
)`
let lineLength = `import type { FC } from 'react'
import {
useCallback,
useEffect,
useState,
useId,
} from 'react'
import { FormValues } from '~/stores/auth'
import Button from '~/components/Button'
import Input from '~/components/Input'
import Form from '~/component/Form'
import './style.css'
interface Props {
onSubmit: (values: FormValues) => void
resetFormValues: () => void
className?: string
title: string
id: string
}
const Auth: FC<Props> => (props) => (
<Form {...props}>
<Input
validation={/^[^s@]+@[^s@]+.[^s@]+$/i}
placeholder="Enter your email"
label="Email address"
name="user-email"
type="email"
full
/>
<Button
className="submit-button"
color="secondary"
type="submit"
size="l"
>
Submit
</Button>
</Form>
)`
let initial = dedent`
import Button from '~/components/Button'
import type { FC } from 'react'
import {
useId,
useCallback,
useState,
useEffect,
} from 'react'
import Form from '~/component/Form'
import './style.css'
import Input from '~/components/Input'
import { FormValues } from '~/stores/auth'
interface Props {
className?: string
onSubmit: (values: FormValues) => void
id: string
resetFormValues: () => void
title: string
}
const Auth: FC<Props> = (props) => (
<Form {...props}>
<Input
placeholder="Enter your email"
full
name="user-email"
validation={/^[^s@]+@[^s@]+.[^s@]+$/i}
type="email"
label="Email address"
/>
<Button
type="submit"
className="submit-button"
size="l"
color="secondary"
>
Submit
</Button>
</Form>
)`
let alphabetical = dedent`
import type { FC } from 'react'
import {
useCallback,
useEffect,
useId,
useState,
} from 'react'
import Button from '~/components/Button'
import Form from '~/component/Form'
import Input from '~/components/Input'
import { FormValues } from '~/stores/auth'
import './style.css'
interface Props {
className?: string
id: string
onSubmit: (values: FormValues) => void
resetFormValues: () => void
title: string
}
const Auth: FC<Props> = (props) => (
<Form {...props}>
<Input
full
label="Email address"
name="user-email"
placeholder="Enter your email"
type="email"
validation={/^[^s@]+@[^s@]+.[^s@]+$/i}
/>
<Button
className="submit-button"
color="secondary"
size="l"
type="submit"
>
Submit
</Button>
</Form>
)`
let lineLength = dedent`
import type { FC } from 'react'
import {
useCallback,
useEffect,
useState,
useId,
} from 'react'
import { FormValues } from '~/stores/auth'
import Button from '~/components/Button'
import Input from '~/components/Input'
import Form from '~/component/Form'
import './style.css'
interface Props {
onSubmit: (values: FormValues) => void
resetFormValues: () => void
className?: string
title: string
id: string
}
const Auth: FC<Props> = (props) => (
<Form {...props}>
<Input
validation={/^[^s@]+@[^s@]+.[^s@]+$/i}
placeholder="Enter your email"
label="Email address"
name="user-email"
type="email"
full
/>
<Button
className="submit-button"
color="secondary"
type="submit"
size="l"
>
Submit
</Button>
</Form>
)`
---

<section class="demo">
Expand Down
Binary file modified docs/public/examples/example-alphabetical-dark.webp
Binary file not shown.
Binary file modified docs/public/examples/example-alphabetical-light.webp
Binary file not shown.
Binary file modified docs/public/examples/example-line-length-dark.webp
Binary file not shown.
Binary file modified docs/public/examples/example-line-length-light.webp
Binary file not shown.

0 comments on commit 35a70c4

Please sign in to comment.