Create/update snippet with tags. DB migration to support tags

This commit is contained in:
unknown
2021-09-27 12:12:19 +02:00
parent 8c603dcd2f
commit bd7eaf3d17
10 changed files with 89 additions and 6 deletions

View File

@@ -25,7 +25,8 @@ export const SnippetForm = (props: Props): JSX.Element => {
language: '',
code: '',
docs: '',
isPinned: false
isPinned: false,
tags: ''
});
useEffect(() => {
@@ -109,11 +110,31 @@ export const SnippetForm = (props: Props): JSX.Element => {
id='language'
name='language'
value={formData.language}
placeholder='bash'
placeholder='python'
required
onChange={e => inputHandler(e)}
/>
</div>
{/* TAGS */}
<div className='mb-3'>
<label htmlFor='tags' className='form-label'>
Tags
</label>
<input
type='text'
className='form-control'
id='tags'
name='tags'
value={formData.tags}
placeholder='automation, files, loop'
required
onChange={e => inputHandler(e)}
/>
<div className='form-text'>
Language tag will be added automatically
</div>
</div>
<hr />
{/* CODE SECTION */}

View File

@@ -7,6 +7,7 @@ export interface NewSnippet {
code: string;
docs?: string;
isPinned: boolean;
tags: string;
}
export interface Snippet extends Model, NewSnippet {}