Skip to content

Commit

Permalink
move gradientSelector function to keystatic helper
Browse files Browse the repository at this point in the history
  • Loading branch information
simonswiss committed Jul 15, 2024
1 parent 9700e59 commit 4528786
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 19 deletions.
21 changes: 2 additions & 19 deletions docs/keystatic.config.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
// keystatic.config.ts
import { config, fields, collection, singleton } from '@keystatic/core'
import { superscriptIcon } from '@keystar/ui/icon/icons/superscriptIcon'

import { inline, mark, wrapper } from '@keystatic/core/content-components'
// import { WellPreview } from './keystatic/admin-previews'

import { gradientSelector } from './keystatic/gradient-selector'

export default config({
storage: {
Expand Down Expand Up @@ -310,19 +309,3 @@ export default config({
}),
},
})

type Gradient = 'grad1' | 'grad2' | 'grad3' | 'grad4'

function gradientSelector({ defaultValue = 'grad1' }: { defaultValue: Gradient }) {
return fields.select({
label: 'Gradient',
description: 'The gradient to use for the group',
options: [
{ label: '1', value: 'grad1' },
{ label: '2', value: 'grad2' },
{ label: '3', value: 'grad3' },
{ label: '4', value: 'grad4' },
],
defaultValue: defaultValue,
})
}
17 changes: 17 additions & 0 deletions docs/keystatic/gradient-selector.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { fields } from '@keystatic/core'

type Gradient = 'grad1' | 'grad2' | 'grad3' | 'grad4'

export function gradientSelector ({ defaultValue = 'grad1' }: { defaultValue: Gradient }) {
return fields.select({
label: 'Gradient',
description: 'The gradient to use for the group',
options: [
{ label: '1', value: 'grad1' },
{ label: '2', value: 'grad2' },
{ label: '3', value: 'grad3' },
{ label: '4', value: 'grad4' },
],
defaultValue: defaultValue,
})
}

0 comments on commit 4528786

Please sign in to comment.