mirror of
https://github.com/pawelmalak/snippet-box.git
synced 2025-12-21 21:33:10 +01:00
Create/update snippet with tags. DB migration to support tags
This commit is contained in:
@@ -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 */}
|
||||
|
||||
@@ -7,6 +7,7 @@ export interface NewSnippet {
|
||||
code: string;
|
||||
docs?: string;
|
||||
isPinned: boolean;
|
||||
tags: string;
|
||||
}
|
||||
|
||||
export interface Snippet extends Model, NewSnippet {}
|
||||
|
||||
Reference in New Issue
Block a user