chore: prettier

This commit is contained in:
41666 2020-10-10 04:33:54 -04:00
parent ccf89d8480
commit 70fa51d4a1
67 changed files with 1811 additions and 1838 deletions

View file

@ -1,30 +1,30 @@
import { text } from "@storybook/addon-knobs";
import * as React from "react";
import { Avatar } from "./Avatar";
import { text } from '@storybook/addon-knobs';
import * as React from 'react';
import { Avatar } from './Avatar';
export default {
title: "Atoms/Avatar",
component: Avatar,
argTypes: {
initials: { control: "text" },
},
args: {
initials: "KR",
},
title: 'Atoms/Avatar',
component: Avatar,
argTypes: {
initials: { control: 'text' },
},
args: {
initials: 'KR',
},
};
export const WithInitials = ({ initials, ...rest }) => (
<Avatar src="https://i.imgur.com/epMSRQH.png" size={48} {...rest}>
{initials}
</Avatar>
<Avatar src="https://i.imgur.com/epMSRQH.png" size={48} {...rest}>
{initials}
</Avatar>
);
export const WithText = ({ initials, ...rest }) => (
<Avatar size={48} {...rest}>
{initials}
</Avatar>
<Avatar size={48} {...rest}>
{initials}
</Avatar>
);
export const Empty = (args) => <Avatar size={48} {...args}></Avatar>;
export const DeliberatelyEmpty = (args) => (
<Avatar size={48} deliberatelyEmpty={true} {...args}></Avatar>
<Avatar size={48} deliberatelyEmpty={true} {...args}></Avatar>
);

View file

@ -1,46 +1,45 @@
import { AvatarProps } from "./Avatar";
import styled, { css } from "styled-components";
import * as _ from "styled-components"; // tslint:disable-line:no-duplicate-imports
import { palette } from "roleypoly/src/design-system/atoms/colors";
import { AvatarProps } from './Avatar';
import styled, { css } from 'styled-components';
import * as _ from 'styled-components'; // tslint:disable-line:no-duplicate-imports
import { palette } from 'roleypoly/src/design-system/atoms/colors';
type ContainerProps = Pick<AvatarProps, "size"> &
Pick<AvatarProps, "deliberatelyEmpty">;
type ContainerProps = Pick<AvatarProps, 'size'> & Pick<AvatarProps, 'deliberatelyEmpty'>;
export const Container = styled.div<ContainerProps>`
border-radius: 100%;
box-sizing: border-box;
width: ${(props: ContainerProps) => props.size || 48}px;
height: ${(props: ContainerProps) => props.size || 48}px;
min-width: ${(props: ContainerProps) => props.size || 48}px;
min-height: ${(props: ContainerProps) => props.size || 48}px;
display: flex;
justify-content: center;
align-items: center;
color: ${palette.grey100};
position: relative;
background-color: ${palette.grey500};
font-weight: bold;
text-align: center;
line-height: 1;
overflow: hidden;
font-size: ${(props: ContainerProps) => props.size};
${(props) =>
props.deliberatelyEmpty &&
css`
border: 4px solid rgba(0, 0, 0, 0.25);
background-color: ${palette.taupe400};
color: ${palette.taupe600};
`}
border-radius: 100%;
box-sizing: border-box;
width: ${(props: ContainerProps) => props.size || 48}px;
height: ${(props: ContainerProps) => props.size || 48}px;
min-width: ${(props: ContainerProps) => props.size || 48}px;
min-height: ${(props: ContainerProps) => props.size || 48}px;
display: flex;
justify-content: center;
align-items: center;
color: ${palette.grey100};
position: relative;
background-color: ${palette.grey500};
font-weight: bold;
text-align: center;
line-height: 1;
overflow: hidden;
font-size: ${(props: ContainerProps) => props.size};
${(props) =>
props.deliberatelyEmpty &&
css`
border: 4px solid rgba(0, 0, 0, 0.25);
background-color: ${palette.taupe400};
color: ${palette.taupe600};
`}
`;
type ImageProps = Pick<AvatarProps, "src">;
type ImageProps = Pick<AvatarProps, 'src'>;
export const Image = styled.div<ImageProps>`
background-size: cover;
background-repeat: no-repeat;
background-position: 50% 50%;
top: 0;
left: 0;
right: 0;
bottom: 0;
position: absolute;
border-radius: 100%;
background-size: cover;
background-repeat: no-repeat;
background-position: 50% 50%;
top: 0;
left: 0;
right: 0;
bottom: 0;
position: absolute;
border-radius: 100%;
`;