Tag.tsx 742 Bytes
Newer Older
1
2
3
import * as React from 'react';
import { Tag as ZenTag, Close } from '@zendeskgarden/react-tags';

4
5
import styled from '../../../themes/styled';

6
export type TagProps = {
Sam Gluck's avatar
Sam Gluck committed
7
  onClick?: Function;
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
  closeable?: boolean;
  onClose?: Function;
  focused?: boolean;
  hovered?: boolean;
  pill?: boolean;
  size?: 'small' | 'large';
  type?: 'grey' | 'blue' | 'kale' | 'red' | 'green' | 'yellow';
};

const Tag: React.SFC<TagProps> = ({
  children,
  closeable = false,
  onClose = () => {},
  ...props
}) => {
  return (
    <ZenTag {...props}>
      {children}
      {closeable ? <Close onClick={onClose} /> : null}
    </ZenTag>
  );
};

31
32
33
34
35
36
export const TagContainer = styled.div`
  ${ZenTag} {
    margin: 0 10px 10px 0;
  }
`;

37
export default Tag;