Added DefinitionList and DefinitionItem components
This commit is contained in:
25
src/keystatic/components/general/definitionlist.ts
Normal file
25
src/keystatic/components/general/definitionlist.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
import { listTreeIcon } from '@keystar/ui/icon/icons/listTreeIcon';
|
||||
import { fields } from '@keystatic/core';
|
||||
import { repeating, block } from '@keystatic/core/content-components';
|
||||
|
||||
export const definitionlistComponents = {
|
||||
DefinitionList: repeating({
|
||||
label: 'Definition List',
|
||||
icon: listTreeIcon,
|
||||
children: ['DefinitionItem'],
|
||||
schema: {},
|
||||
}),
|
||||
DefinitionItem: block({
|
||||
label: 'Definition Item',
|
||||
schema: {
|
||||
term: fields.text({ label: 'Term' }),
|
||||
definitions: fields.array(
|
||||
fields.text({ label: 'Definition', multiline: true }),
|
||||
{
|
||||
label: 'Definitions',
|
||||
itemLabel: (props) => props.value || 'Definition',
|
||||
}
|
||||
),
|
||||
},
|
||||
}),
|
||||
};
|
||||
@@ -1,4 +1,9 @@
|
||||
import { gridComponents } from '@/keystatic/components/general/grid';
|
||||
import { sidenoteComponents } from '@/keystatic/components/general/sidenote';
|
||||
import { definitionlistComponents } from '@/keystatic/components/general/definitionlist';
|
||||
|
||||
export const generalComponents = { ...gridComponents, ...sidenoteComponents };
|
||||
export const generalComponents = {
|
||||
...gridComponents,
|
||||
...sidenoteComponents,
|
||||
...definitionlistComponents,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user