Skip to content

Commit 86caa86

Browse files
committed
feat(json-crdt-peritext-ui): 🎸 add url clearing button
1 parent 3a4b928 commit 86caa86

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

src/json-crdt-peritext-ui/plugins/toolbar/cards/InlineConfigCard.tsx

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import {useSyncStore} from '../../../web/react/hooks';
1414
import {ContextSep} from 'nice-ui/lib/4-card/ContextMenu';
1515
import {UrlDisplayCard} from './UrlDisplayCard';
1616
import type {SliceConfigState} from '../state/types';
17+
import {BasicButtonClose} from 'nice-ui/lib/2-inline-block/BasicButton/BasicButtonClose';
1718

1819
export interface InlineConfigCardProps {
1920
config: SliceConfigState<any>;
@@ -51,14 +52,20 @@ export const InlineConfigCard: React.FC<InlineConfigCardProps> = ({config, onSav
5152
)}
5253
</ContextPaneHeader>
5354
<div style={{padding: '8px 16px'}}>
54-
<FormRow title={'Address'}>
55+
<FormRow>
5556
<CollaborativeInput str={href}
56-
input={(ref) => <Input focus inp={ref} type={'text'} size={-1} placeholder={'https://'} onKeyDown={(e) => {
57+
input={(ref) => <Input focus inp={ref} type={'text'} size={-1} placeholder={'https://'}
58+
onKeyDown={(e) => {
5759
if (e.key === 'Enter') {
5860
e.preventDefault();
5961
onSave();
6062
}
61-
}} />} />
63+
}} right={(
64+
<div style={{paddingRight: 8, width: 24, height: 24}}>
65+
{!!hrefView && <BasicButtonClose onClick={() => href().del(0, href().length())} />}
66+
</div>
67+
)}
68+
/>} />
6269
</FormRow>
6370
{/* <FormRow title={'Title'}>
6471
<CollaborativeInput str={title}
@@ -67,6 +74,7 @@ export const InlineConfigCard: React.FC<InlineConfigCardProps> = ({config, onSav
6774
</div>
6875

6976
<ContextSep line />
77+
<ContextSep />
7078
<ContextTitle>Preview</ContextTitle>
7179
{hrefView ? (
7280
<div style={{display: 'flex', padding: '24px 16px 32px', alignItems: 'center', justifyContent: 'center'}}>

0 commit comments

Comments
 (0)