Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
connor-baer committed Dec 1, 2020
1 parent a062c97 commit f8f3335
Show file tree
Hide file tree
Showing 7 changed files with 46 additions and 15 deletions.
18 changes: 18 additions & 0 deletions src/cli/static-styles/config.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,15 @@ import { light } from '@sumup/design-tokens';
import Anchor from '../../components/Anchor';
import Badge from '../../components/Badge';
import Button from '../../components/Button';
// import Blockquote from '../../components/Blockquote';
// import ButtonGroup from '../../components/ButtonGroup';
// import Checkbox from '../../components/Checkbox';
// import Hamburger from '../../components/Hamburger';
// import Heading from '../../components/Heading';
// import Hr from '../../components/Hr';
// import Image from '../../components/Image';
// import Input from '../../components/Input';
// import Label from '../../components/Label';

import { ComponentConfig, PropTypes } from './types';

Expand All @@ -47,4 +56,13 @@ export const components: ComponentConfig[] = [
component: Button,
propTypes: { icon: propTypes.element },
},
// { name: 'Blockquote', component: Blockquote },
// { name: 'ButtonGroup', component: ButtonGroup },
// { name: 'Checkbox', component: Checkbox },
// { name: 'Hamburger', component: Hamburger },
// { name: 'Heading', component: Heading },
// { name: 'Hr', component: Hr },
// { name: 'Image', component: Image },
// { name: 'Input', component: Input },
// { name: 'Label', component: Label },
];
8 changes: 3 additions & 5 deletions src/components/Blockquote/Blockquote.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,18 @@
* limitations under the License.
*/

import React from 'react';
import React, { forwardRef } from 'react';
import { css } from '@emotion/core';

import styled, { StyleProps } from '../../styles/styled';
import Text from '../Text';
import { TextProps } from '../Text/Text';

type Size = 'kilo' | 'mega' | 'giga';

export interface BlockquoteProps extends TextProps {
/**
* A Circuit UI body text size.
*/
size?: Size;
size?: 'kilo' | 'mega' | 'giga';
/**
* The ref to the HTML DOM element.
*/
Expand All @@ -52,7 +50,7 @@ const StyledText = styled(Text)<BlockquoteProps>(baseStyles, gigaStyles);
/**
* Indented and italicised text to denote a quotation.
*/
export const Blockquote = React.forwardRef(
export const Blockquote = forwardRef(
(props: BlockquoteProps, ref: BlockquoteProps['ref']) => (
<StyledText {...props} as="blockquote" italic ref={ref} />
),
Expand Down
7 changes: 5 additions & 2 deletions src/components/ButtonGroup/ButtonGroup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* limitations under the License.
*/

import React, { ReactElement, Ref } from 'react';
import React, { forwardRef, ReactElement, Ref } from 'react';
import { css } from '@emotion/core';

import styled, { StyleProps } from '../../styles/styled';
Expand Down Expand Up @@ -79,6 +79,9 @@ const alignmentMap = {
} as const;

const alignmentStyles = ({ align = 'right' }: ButtonGroupProps) => {
if (!align) {
return null;
}
const label = `button-group--${align}`;

return css`
Expand Down Expand Up @@ -106,7 +109,7 @@ const Wrapper = styled('div')<ButtonGroupProps>(
/**
* Groups its Button children into a list and adds margins between.
*/
export const ButtonGroup = React.forwardRef(
export const ButtonGroup = forwardRef(
({ children, ...props }: ButtonGroupProps, ref: ButtonGroupProps['ref']) => (
<Wrapper {...props} ref={ref}>
{children}
Expand Down
6 changes: 3 additions & 3 deletions src/components/Heading/Heading.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,12 @@ import isPropValid from '@emotion/is-prop-valid';

import styled, { StyleProps } from '../../styles/styled';

type Size = 'kilo' | 'mega' | 'giga' | 'tera' | 'peta' | 'exa' | 'zetta';

export interface HeadingProps
extends Omit<HTMLProps<HTMLHeadingElement>, 'size'> {
/**
* A Circuit UI heading size.
*/
size?: Size;
size?: 'kilo' | 'mega' | 'giga' | 'tera' | 'peta' | 'exa' | 'zetta';
/**
* Removes the default bottom margin from the heading.
*/
Expand All @@ -37,6 +35,8 @@ export interface HeadingProps
as?: string;
}

type Size = 'kilo' | 'mega' | 'giga' | 'tera' | 'peta' | 'exa' | 'zetta';

const mobileSizeMap: { [key in Size]: Size } = {
kilo: 'kilo',
mega: 'mega',
Expand Down
14 changes: 11 additions & 3 deletions src/components/IconButton/IconButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

/** @jsx jsx */
import React, { Children, cloneElement, ReactElement } from 'react';
import { css, jsx, SerializedStyles } from '@emotion/core';
import { css, jsx } from '@emotion/core';
import { Theme } from '@sumup/design-tokens';

import { hideVisually } from '../../styles/style-helpers';
Expand All @@ -34,11 +34,19 @@ export interface IconButtonProps extends Omit<ButtonProps, 'icon' | 'stretch'> {
label: string;
}

const Label = styled('span')(hideVisually);
const labelStyles = css`
label: button__label;
${hideVisually()};
`;

const Label = styled('span')(labelStyles);

const sizeStyles = (size: IconButtonProps['size'] = 'mega') => (
theme: Theme,
): SerializedStyles => {
) => {
if (!size) {
return null;
}
const sizeMap = {
kilo: theme.spacings.byte,
mega: theme.spacings.kilo,
Expand Down
6 changes: 5 additions & 1 deletion src/components/Input/Input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ const inputBaseStyles = ({ theme }: StyleProps) => css`
width: 100%;
margin: 0;
${textMega({ theme })};
${inputOutline({ theme })};
&::placeholder {
color: ${theme.colors.n500};
Expand All @@ -162,6 +163,8 @@ const inputWarningStyles = ({
hasWarning &&
css`
label: input--warning;
${inputOutline({ theme, hasWarning })};
&:not(:focus)::placeholder {
color: ${theme.colors.warning};
}
Expand All @@ -176,6 +179,8 @@ const inputInvalidStyles = ({
invalid &&
css`
label: input--error;
${inputOutline({ theme, invalid })};
&:not(:focus)::placeholder {
color: ${theme.colors.danger};
opacity: 0.5;
Expand Down Expand Up @@ -226,7 +231,6 @@ const InputElement = styled('input')<InputElProps>(
inputDisabledStyles,
inputPrefixStyles,
inputSuffixStyles,
inputOutline,
);

/**
Expand Down
2 changes: 1 addition & 1 deletion src/components/Label/Label.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ const inlineStyles = ({ theme, inline }: StyleProps & LabelProps) =>
const disabledStyles = ({ disabled }: LabelProps) =>
disabled &&
css`
label: input__label--disabled;
label: label--disabled;
${disableVisually()};
`;

Expand Down

0 comments on commit f8f3335

Please sign in to comment.