Skip to content

Commit

Permalink
chore(docs): cleanup docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Kosai106 committed Oct 12, 2024
1 parent daf739d commit 70226ee
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 2 deletions.
1 change: 1 addition & 0 deletions apps/docs/pages/modifiers/custom.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ If you have specific needs that are not met by existing modifiers, the `custom`
- `number`: [Learn more](/schemas/number).
- `regex`: [Learn more](/schemas/regex).
- `string`: [Learn more](/schemas/string).
- `array`: [Learn more](/schemas/array).

## Arguments

Expand Down
16 changes: 15 additions & 1 deletion apps/docs/pages/modifiers/max.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ A modifier which creates a validation rule to ensure that a given value is less

import { Tabs, Tab } from 'nextra/components'

<Tabs items={['Number', 'String', 'Date']}>
<Tabs items={['Number', 'String', 'Date', 'Array']}>
<Tab>
```ts
import { max, number } from '@nordic-ui/validathor';
Expand Down Expand Up @@ -61,4 +61,18 @@ import { Tabs, Tab } from 'nextra/components'
}
```
</Tab>
<Tab>
```ts
import { max, array } from '@nordic-ui/validathor';

const schema = array([max(3)]);

try {
const parsedValue = schema.parse([1, 2]);
console.log('Parsed value:', parsedValue);
} catch (error) {
console.error('Parsing failed:', error.message);
}
```
</Tab>
</Tabs>
16 changes: 15 additions & 1 deletion apps/docs/pages/modifiers/min.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ A modifier which creates a validation rule to ensure that a given value is longe

import { Tabs, Tab } from 'nextra/components'

<Tabs items={['Number', 'String', 'Date']}>
<Tabs items={['Number', 'String', 'Date', 'Array']}>
<Tab>
```ts
import { min, number } from '@nordic-ui/validathor';
Expand Down Expand Up @@ -61,4 +61,18 @@ import { Tabs, Tab } from 'nextra/components'
}
```
</Tab>
<Tab>
```ts
import { min, array } from '@nordic-ui/validathor';

const schema = array([min(3)]);

try {
const parsedValue = schema.parse(1, 2, 3, 4);
console.log('Parsed value:', parsedValue);
} catch (error) {
console.error('Parsing failed:', error.message);
}
```
</Tab>
</Tabs>

0 comments on commit 70226ee

Please sign in to comment.