2017-05-18 21:21:33 +03:00
|
|
|
import React from 'react';
|
2017-10-09 21:01:34 +03:00
|
|
|
import { Subscriber } from 'joy-react-broadcast';
|
2017-10-11 17:56:24 +03:00
|
|
|
import is from 'styled-is';
|
2017-05-18 21:21:33 +03:00
|
|
|
import remcalc from 'remcalc';
|
2017-10-09 21:01:34 +03:00
|
|
|
|
2017-05-18 21:21:33 +03:00
|
|
|
import Label from '../label';
|
|
|
|
|
2017-05-25 17:59:58 +03:00
|
|
|
const StyledLabel = Label.extend`
|
2017-05-18 21:21:33 +03:00
|
|
|
margin-right: ${remcalc(12)};
|
2018-02-01 17:33:58 +02:00
|
|
|
font-weight: ${props => props.theme.font.weight.semibold};
|
2017-10-13 23:01:16 +03:00
|
|
|
white-space: pre;
|
2017-11-16 12:47:32 +02:00
|
|
|
font-size: ${remcalc(13)};
|
2017-10-13 23:01:16 +03:00
|
|
|
|
2018-02-23 17:59:12 +02:00
|
|
|
${is('actionable')`
|
|
|
|
cursor: pointer;
|
|
|
|
`};
|
|
|
|
|
2018-02-09 14:41:54 +02:00
|
|
|
${is('disabled')`
|
2017-10-11 17:56:24 +03:00
|
|
|
color: ${props => props.theme.grey};
|
|
|
|
`};
|
2018-02-13 22:33:03 +02:00
|
|
|
|
2018-02-09 14:41:54 +02:00
|
|
|
${is('big')`
|
2018-02-13 22:33:03 +02:00
|
|
|
font-size: ${remcalc(15)};
|
|
|
|
`};
|
|
|
|
|
2018-02-09 14:41:54 +02:00
|
|
|
${is('normal')`
|
2018-02-13 22:33:03 +02:00
|
|
|
font-weight: ${props => props.theme.font.weight.normal};
|
|
|
|
`};
|
2018-02-27 16:40:35 +02:00
|
|
|
|
|
|
|
${is('noMargin')`
|
|
|
|
margin: 0;
|
|
|
|
`};
|
2017-05-18 21:21:33 +03:00
|
|
|
`;
|
|
|
|
|
|
|
|
export default props => {
|
|
|
|
const render = value => {
|
|
|
|
const { id = '' } = value || {};
|
|
|
|
return <StyledLabel {...props} htmlFor={id} />;
|
|
|
|
};
|
|
|
|
|
2017-08-30 03:22:35 +03:00
|
|
|
return <Subscriber channel="input-group">{render}</Subscriber>;
|
2017-05-18 21:21:33 +03:00
|
|
|
};
|