mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2025-12-30 15:22:41 +00:00
Merge branch 'Functional-Tag-Editor' into Func-Tag-Editor-Features
This commit is contained in:
@@ -1,3 +1,4 @@
|
|||||||
|
require('./tagInput.less');
|
||||||
const React = require('react');
|
const React = require('react');
|
||||||
const { useState, useEffect } = React;
|
const { useState, useEffect } = React;
|
||||||
const _ = require('lodash');
|
const _ = require('lodash');
|
||||||
@@ -57,13 +58,13 @@ const TagInput = ({ unique = true, values = [], ...props }) => {
|
|||||||
|
|
||||||
const renderReadTag = (context, index) => {
|
const renderReadTag = (context, index) => {
|
||||||
return (
|
return (
|
||||||
<div key={index}
|
<li key={index}
|
||||||
data-value={context.value}
|
data-value={context.value}
|
||||||
className='tag'
|
className='tag'
|
||||||
onClick={() => editTag(context.value)}>
|
onClick={() => editTag(context.value)}>
|
||||||
{context.value}
|
{context.value}
|
||||||
<button onClick={(evt)=>{evt.stopPropagation(); submitTag(null, context.value, index)}}><i className='fa fa-times fa-fw'/></button>
|
<button onClick={(evt)=>{evt.stopPropagation(); submitTag(null, context.value, index)}}><i className='fa fa-times fa-fw'/></button>
|
||||||
</div>
|
</li>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -81,8 +82,10 @@ const TagInput = ({ unique = true, values = [], ...props }) => {
|
|||||||
return (
|
return (
|
||||||
<div className='field'>
|
<div className='field'>
|
||||||
<label>{props.label}</label>
|
<label>{props.label}</label>
|
||||||
<div className='list'>
|
<div className='tag-input'>
|
||||||
{valueContext.map((context, index) => { return context.editing ? renderWriteTag(context, index) : renderReadTag(context, index); })}
|
<ul className='list'>
|
||||||
|
{valueContext.map((context, index) => { return context.editing ? renderWriteTag(context, index) : renderReadTag(context, index); })}
|
||||||
|
</ul>
|
||||||
|
|
||||||
<input type='text'
|
<input type='text'
|
||||||
className='value'
|
className='value'
|
||||||
|
|||||||
0
client/homebrew/editor/tagInput/tagInput.less
Normal file
0
client/homebrew/editor/tagInput/tagInput.less
Normal file
Reference in New Issue
Block a user