joyent-portal/consoles/my-joy-images/src/components/tags.js

26 lines
749 B
JavaScript
Raw Normal View History

2018-02-05 17:12:47 +02:00
import React from 'react';
import { Margin } from 'styled-components-spacing';
2018-04-06 17:53:44 +03:00
import { TagItem } from 'joyent-ui-toolkit';
import { KeyValue } from 'joyent-ui-resource-widgets';
2018-02-05 17:12:47 +02:00
export const AddForm = props => (
<KeyValue {...props} method="add" input="input" type="tag" expanded />
);
export const EditForm = props => (
<KeyValue {...props} method="edit" input="input" type="tag" expanded />
);
export default ({ norMargin, name, value, onClick, onRemoveClick, active }) => (
<Margin
2018-05-23 19:29:04 +03:00
right={norMargin ? '0' : '1'}
bottom={norMargin ? '0' : '1'}
2018-02-05 17:12:47 +02:00
key={`${name}-${value}`}
>
<TagItem onClick={onClick} active={active} onRemoveClick={onRemoveClick}>
{name ? `${name}: ${value}` : value}
</TagItem>
</Margin>
);