Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Tag icon + Keystar Badge for the tags content component #1256

Merged
merged 2 commits into from
Aug 1, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 9 additions & 15 deletions docs/keystatic.config.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,18 @@ import {
repeating,
wrapper,
} from '@keystatic/core/content-components';
import { isNonEmptyArray } from 'emery/guards';

import { Badge } from '@keystar/ui/badge';
import { Flex } from '@keystar/ui/layout';
import Markdoc, { Config, Node, ValidateError } from '@markdoc/markdoc';
import { tagIcon } from '@keystar/ui/icon/icons/tagIcon';
import { isNonEmptyArray } from 'emery/guards';
import { assert } from 'emery/assertions';
import Markdoc, { Config, Node, ValidateError } from '@markdoc/markdoc';

export const components = {
tags: block({
label: 'Tags',
description: 'Insert tags',
icon: tagIcon,
schema: {
tags: fields.multiselect({
label: 'Project tags',
Expand All @@ -30,20 +33,11 @@ export const components = {
},
ContentView({ value }) {
return (
<div style={{ display: 'flex', gap: '1rem' }}>
<Flex gap="small">
{value.tags.map(tag => (
<span
style={{
border: 'solid 1px #ddd',
padding: '0.25rem 0.5rem',
borderRadius: '20px',
fontSize: '11px',
}}
>
{tag}
</span>
<Badge>{tag}</Badge>
))}
</div>
</Flex>
);
},
}),
Expand Down
Loading