12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970 |
- import React from 'react';
- import { useTranslation } from 'react-i18next';
- import Icon from '../Icon';
- import Typography from '../Typography';
- import SliderWithTitle from '../SliderWithTitle';
- import ColorSelector from '../../containers/ColorSelector';
- import { Group, Item, Wrapper } from '../../global/toolStyled';
- import data from './data';
- const HighlightOption: React.SFC<OptionPropsType> = ({
- type,
- color,
- opacity,
- setDataState = (): void => {
- // do nothing
- },
- }: OptionPropsType) => {
- const { t } = useTranslation('sidebar');
- return (
- <>
- <Wrapper>
- <Typography
- variant="subtitle"
- style={{ marginTop: '8px' }}
- align="left"
- >
- {t('style')}
- </Typography>
- <Group>
- {data.lineType.map((ele) => (
- <Item
- key={ele.key}
- selected={type === ele.key}
- onClick={(): void => {
- setDataState({ type: ele.key, color: ele.color });
- }}
- >
- <Icon glyph={ele.icon} />
- </Item>
- ))}
- </Group>
- </Wrapper>
- <Wrapper>
- <ColorSelector
- title={t('color')}
- selectedColor={color}
- onClick={(selected: string): void => {
- setDataState({ color: selected });
- }}
- throughPortal
- />
- </Wrapper>
- <Wrapper>
- <SliderWithTitle
- title={t('opacity')}
- value={opacity}
- tips={`${opacity}%`}
- onSlide={(val: number): void => {
- setDataState({ opacity: val });
- }}
- />
- </Wrapper>
- </>
- );
- };
- export default HighlightOption;
|