UNPKG

@workday/canvas-kit-react

Version:

The parent module that contains all Workday Canvas Kit React components

19 lines (18 loc) 912 B
import * as React from 'react'; import styled from '@emotion/styled'; import { createComponent } from '@workday/canvas-kit-react/common'; import { colors, space } from '@workday/canvas-kit-react/tokens'; import { px2rem } from '@workday/canvas-kit-styling'; const Shape = styled('div')(({ backgroundColor, borderRadius, height, width }) => ({ backgroundColor, borderRadius, outline: `${px2rem(1)} solid transparent`, outlineOffset: `-${px2rem(1)}`, height, width, marginBottom: space.s, })); export const SkeletonShape = createComponent('div')({ displayName: 'Skeleton.Shape', Component: ({ backgroundColor = colors.soap200, borderRadius = 0, height = '100%', width = '100%', ...elemProps }, ref, Element) => (React.createElement(Shape, { ref: ref, as: Element, backgroundColor: backgroundColor, borderRadius: borderRadius, height: height, width: width, ...elemProps })), });