How to use the @xstyled/system.th.radius function in @xstyled/system

To help you get started, we’ve selected a few @xstyled/system examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github DefinitelyTyped / DefinitelyTyped / types / xstyled__system / xstyled__system-tests.tsx View on Github external
);

// TH

th('colors.primary900')({});

th.color(2)({});
th.color('primary')({});

th.px(2)({});
th.px('2rpx')({});

th.percent(0.3)({});
th.percent('20em')({});

th.radius(2)({});
th.radius('sm')({});

th.transition(2)({});
th.transition('fade')({});

th.space(2)({});
th.space('sm')({});

th.size(2)({});
th.size('sm')({});

th.font(2)({});
th.font('body')({});

th.lineHeight(2)({});
th.lineHeight('sm')({});
github RetailMeNot / anchor / src / Button / Button.component.tsx View on Github external
const OutlineStyles = ({ buttonStyles, borderRadius }: StyledButtonProps) =>
    css`
        &:after {
            position: absolute;
            content: '';

            // overlap border (1px) and extend 2px past
            // TODO: determine approach for spacing with larger than 1px borders
            top: -3px;
            left: -3px;
            right: -3px;
            bottom: -3px;

            border-radius: calc(${th.radius(borderRadius)} + 2px);

            // shadow instead of border so that it doesn't contribute to clickable area
            ${buttonStyles.focusOutline}
        }
    `;
github smooth-code / smooth-ui / packages / shared / core / Button.js View on Github external
Button: p => {
          const { outline } = p
          const scale = p.scale || 'base'
          const baseColor =
            p.variant === null ? null : th.color(p.variant || 'primary')(p)
          const px = th.space(`textFormControl.x.${scale}`)(p)
          const py = th.space(`textFormControl.y.${scale}`)(p)
          return css`
            display: inline-block;
            z-index: ${th.zIndex('control')(p)};
            font-family: ${th.font('base')(p)};
            font-size: ${th.fontSize(scale)(p)};
            padding: ${py} ${px};
            border-radius: ${th.radius(scale)(p)};
            line-height: ${th.lineHeight(`formControl.${scale}`)(p)};
            border-width: ${th.borderWidth(`button.${scale}`)(p)};
            cursor: ${p.disabled ? 'initial' : 'pointer'};
            ${safeTransition('base')(p)};

            /* When used as link */
            text-decoration: none;

            &[type='button'] {
              appearance: none;
            }

            &:disabled {
              opacity: 0.8;
            }
github smooth-code / smooth-ui / packages / shared / core / Card.js View on Github external
CardHeader: p => {
          const baseRadius = th.radius('base')(p)
          return css`
            padding: 0.75rem 1.25rem;
            margin-bottom: 0; /* Removes the default margin-bottom of  */
            background-color: ${th.color('highlightBackground')(p)};
            border-bottom: 0.0625rem solid;
            border-bottom-color: ${th.color('highlightBorder')(p)};

            &:first-child {
              border-radius: calc(${baseRadius} - 1px) calc(${baseRadius} - 1px)
                0 0;
            }

            && {
              ${system(p)}
            }
          `
github smooth-code / smooth-ui / packages / shared / core / Checkbox.js View on Github external
Checkbox: p => {
          const scale = p.scale || 'base'
          const validColor = th.color('form.valid')(p)
          const invalidColor = th.color('form.invalid')(p)
          const containerSize = th.size(`checkbox.container.${scale}`)(p)
          const checkmarkSize = th.size(`checkbox.checkmark.${scale}`)(p)
          return css`
            display: inline-flex;
            align-items: center;
            justify-content: center;
            position: relative;
            width: ${containerSize};
            height: ${containerSize};
            z-index: ${th.zIndex('control')(p)};
            background-color: ${th.color('formControl.background')(p)};
            border-radius: ${th.radius(scale)(p)};
            border-style: solid;
            border-width: ${th.borderWidth(`formControl.${scale}`)(p)};
            border-color: ${th.color('formControl.border')(p)};
            ${safeTransition('base')(p)};

            input {
              top: 0;
              left: 0;
              width: 100%;
              cursor: inherit;
              height: 100%;
              margin: 0;
              opacity: 0;
              padding: 0;
              position: absolute;
            }
github smooth-code / smooth-ui / packages / shared / core / Menu.js View on Github external
Menu: p => {
          return css`
            border: 0.0625rem solid;
            border-color: ${th.color('highlightBorder')(p)};
            font-family: ${th.font('base')(p)};
            background-color: ${th.color('lighter')(p)};
            border-radius: ${th.radius('base')(p)};
            padding: 0.5rem 0.25rem;
            z-index: 999;

            &:focus {
              outline: none;
            }

            &[data-animated='true'] {
              transition: ${th.transition('base')(p)};
              transition-property: opacity;
              display: block !important;

              &[hidden][data-animating='false'] {
                display: none !important;
              }
github smooth-code / smooth-ui / packages / shared / core / Input.js View on Github external
return css`
            display: block;
            appearance: none;
            width: 100%;
            z-index: ${th.zIndex('control')(p)};
            font-family: ${th.font('base')(p)};
            font-size: ${th.fontSize(scale)(p)};
            border-width: ${th.borderWidth(`formControl.${scale}`)(p)};
            border-color: ${th.color('formControl.border')(p)};
            border-style: solid;
            line-height: ${th.lineHeight(`formControl.${scale}`)(p)};
            color: ${th.color('formControl.text')(p)};
            background-color: ${th.color('formControl.background')(p)};
            padding: ${py} ${px};
            line-height: ${th.lineHeight(`button.${scale}`)(p)};
            border-radius: ${th.radius(scale)(p)};
            ${safeTransition('base')(p)};

            &[type='number'] {
              padding-right: 6rpx;
            }

            &::placeholder {
              color: ${th.color('formControl.placeholder')(p)};
            }

            &:disabled {
              background-color: ${th.color('formControl.disabled.background')(
                p,
              )};
              color: ${th.color('formControl.disabled.text')(p)};
            }
github RetailMeNot / anchor / src / AutoComplete / ResultsContainer / ResultsContainer.component.tsx View on Github external
}

const ResultContainerSpaceFromAutoComplete = {
    sm: '2.6rem',
    md: '3.25rem',
    lg: '3.25rem',
};

const StyledResultsContainer = styled('div')`
    background-color: white;
    position: absolute;
    width: inherit;
    z-index: 3;
    box-sizing: border-box;
    box-shadow: 0 0.5rem 0.75rem -0.375rem rgba(0, 0, 0, 0.2);
    border-radius: 0 0 ${th.radius('base')} ${th.radius('base')};
    padding: 1rem;
    ${({ size = 'md' }) =>
        css({ top: ResultContainerSpaceFromAutoComplete[size] })};
`;

const createResult = (label: string, value?: any): DataItem => ({
    label: label,
    value: value || label,
});

type ObjectItem = { label: string; [key: string]: any };

const generateResults = (
    results: any[],
    currentIndex: number,
    setCurrentIndex: any,
github smooth-code / smooth-ui / packages / shared / core / Alert.js View on Github external
const backgroundColorLevel = th('colorLevels.Alert.backgroundColor')(
            p,
          )
          const borderColorLevel = th('colorLevels.Alert.borderColor')(p)
          const color = colorLevel(baseColor, textColorLevel)(p)
          const backgroundColor = colorLevel(baseColor, backgroundColorLevel)(p)
          const borderColor = colorLevel(baseColor, borderColorLevel)(p)
          const hrColor = darken(0.05, color)
          return css`
            font-family: ${th.font('base')(p)};
            position: relative;
            padding: 12rpx 20rpx;
            margin-bottom: 16rpx;
            border: 1rpx;
            border-color: transparent;
            border-radius: ${th.radius('base')(p)};
            color: ${color};
            background-color: ${backgroundColor};
            border-color: ${borderColor};

            hr {
              border-top-color: ${hrColor};
            }

            && {
              ${system(p)}
            }
          `
        },
      },
github smooth-code / smooth-ui / packages / shared / core / Switch.js View on Github external
Switch: p => {
          const scale = p.scale || 'base'
          const width = th.size(`switch.container.width.${scale}`)(p)
          const height = th.size(`switch.container.height.${scale}`)(p)
          const ballSize = th.size(`switch.container.ball.${scale}`)(p)
          return css`
            display: inline-block;
            position: relative;
            z-index: ${th.zIndex('control')(p)};
            font-family: ${th.font('base')(p)};
            border-radius: ${th.radius('34rpx')(p)};
            width: ${width};
            height: ${height};
            background-color: ${th.color('light300')(p)};
            overflow: hidden;
            cursor: pointer;
            border-width: ${th.borderWidth(`formControl.base`)(p)};
            border-color: ${th.color('formControl.border')(p)};
            border-style: solid;
            font-size: ${th.fontSize(`switch.${scale}`)(p)};
            font-weight: ${th.fontWeight('extraBold')(p)};
            ${safeTransition('base')(p)};

            input {
              top: 0;
              left: 0;
              width: 100%;