UNPKG

@zendeskgarden/react-buttons

Version:

Components relating to buttons in the Garden Design System

29 lines (26 loc) 1.14 kB
/** * Copyright Zendesk, Inc. * * Use of this source code is governed under the Apache License, Version 2.0 * found at http://www.apache.org/licenses/LICENSE-2.0. */ import styled, { css } from 'styled-components'; import { StyledBaseIcon, componentStyles } from '@zendeskgarden/react-theming'; const COMPONENT_ID = 'buttons.icon'; const sizeStyles = props => { let marginProperty; if (props.$position === 'start') { marginProperty = `margin-${props.theme.rtl ? 'left' : 'right'}`; } else if (props.$position === 'end') { marginProperty = `margin-${props.theme.rtl ? 'right' : 'left'}`; } return marginProperty && css(["", ":", "px;"], marginProperty, props.theme.space.base * 2); }; const StyledIcon = styled(StyledBaseIcon).attrs({ 'data-garden-id': COMPONENT_ID, 'data-garden-version': '9.5.4' }).withConfig({ displayName: "StyledIcon", componentId: "sc-19meqgg-0" })(["transform:", ";transition:transform 0.25s ease-in-out,color 0.25s ease-in-out;", ";", ";"], props => props.$isRotated && `rotate(${props.theme.rtl ? '-' : '+'}180deg)`, props => sizeStyles(props), componentStyles); export { StyledIcon };