UNPKG

grommet

Version:

focus on the essential experience

65 lines 3.62 kB
import styled, { css, keyframes } from 'styled-components'; import { normalizeColor, genericStyles, styledComponentsConfig } from '../../utils'; var StyledHour = styled.line.withConfig(styledComponentsConfig).withConfig({ displayName: "StyledClock__StyledHour", componentId: "sc-y4xw8s-0" })(["stroke-width:", ";stroke:", ";transition:stroke 1s ease-out;"], function (props) { return props.theme.clock.analog.hour.width; }, function (props) { return normalizeColor(props.theme.clock.analog.hour.color, props.theme); }); var StyledMinute = styled.line.withConfig(styledComponentsConfig).withConfig({ displayName: "StyledClock__StyledMinute", componentId: "sc-y4xw8s-1" })(["stroke-width:", ";stroke:", ";transition:stroke 1s ease-out;"], function (props) { return props.theme.clock.analog.minute.width; }, function (props) { return normalizeColor(props.theme.clock.analog.minute.color, props.theme); }); var StyledSecond = styled.line.withConfig(styledComponentsConfig).withConfig({ displayName: "StyledClock__StyledSecond", componentId: "sc-y4xw8s-2" })(["stroke-width:", ";stroke:", ";transition:stroke 1s ease-out;"], function (props) { return props.theme.clock.analog.second.width; }, function (props) { return normalizeColor(props.theme.clock.analog.second.color, props.theme); }); var StyledAnalog = styled.svg.withConfig(styledComponentsConfig).withConfig({ displayName: "StyledClock__StyledAnalog", componentId: "sc-y4xw8s-3" })(["width:", ";height:", ";", " ", ";"], function (props) { return props.theme.clock.analog.size[props.size]; }, function (props) { return props.theme.clock.analog.size[props.size]; }, genericStyles, function (props) { return props.theme.clock.analog && props.theme.clock.analog.extend; }); var sizeStyle = function sizeStyle(props) { // size is a combination of the size and height properties var size = props.size || 'medium'; var data = props.theme.clock.digital.text[size] || {}; return css(["font-size:", ";line-height:", ";"], data.size || props.theme.clock.digital.text.medium.size, data.height || props.theme.clock.digital.text.medium.height); }; var StyledDigitalDigit = styled.div.withConfig(styledComponentsConfig).withConfig({ displayName: "StyledClock__StyledDigitalDigit", componentId: "sc-y4xw8s-4" })(["position:relative;width:0.8em;text-align:center;overflow:hidden;", ";"], function (props) { return sizeStyle(props); }); var previousUp = keyframes(["0%{transform:translateY(0);}100%{transform:translateY(-100%);}"]); var previousDown = keyframes(["0%{transform:translateY(0);}100%{transform:translateY(100%);}"]); var StyledDigitalPrevious = styled.div.withConfig(styledComponentsConfig).withConfig({ displayName: "StyledClock__StyledDigitalPrevious", componentId: "sc-y4xw8s-5" })(["position:absolute;top:0;left:0;width:0.8em;text-align:center;animation:", " 0.5s forwards;"], function (props) { return props.direction === 'down' ? previousDown : previousUp; }); var nextUp = keyframes(["0%{transform:translateY(100%);}100%{transform:translateY(0);}"]); var nextDown = keyframes(["0%{transform:translateY(-100%);}100%{transform:translateY(0);}"]); var StyledDigitalNext = styled.div.withConfig(styledComponentsConfig).withConfig({ displayName: "StyledClock__StyledDigitalNext", componentId: "sc-y4xw8s-6" })(["position:absolute;top:0;left:0;width:0.8em;text-align:center;animation:", " 0.5s forwards;"], function (props) { return props.direction === 'down' ? nextDown : nextUp; }); export { StyledHour, StyledMinute, StyledSecond, StyledAnalog, StyledDigitalDigit, StyledDigitalPrevious, StyledDigitalNext };