chore: update prettier tab width for consistency (#175)

This commit is contained in:
41666 2021-03-13 22:54:34 -05:00 committed by GitHub
parent a931f8c69c
commit f24d2fcc99
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
247 changed files with 7224 additions and 7375 deletions

View file

@ -3,32 +3,32 @@ import { mockCategory, roleCategory, roleWikiData } from '../../fixtures/storyDa
import { PickerCategory } from './PickerCategory';
export default {
title: 'Molecules/Picker Category',
component: PickerCategory,
args: {
title: 'Pronouns',
roles: roleCategory,
category: mockCategory,
selectedRoles: [],
},
title: 'Molecules/Picker Category',
component: PickerCategory,
args: {
title: 'Pronouns',
roles: roleCategory,
category: mockCategory,
selectedRoles: [],
},
};
export const Default = (args) => {
return <PickerCategory {...args} />;
return <PickerCategory {...args} />;
};
export const Single = (args) => {
return <PickerCategory {...args} type="single" />;
return <PickerCategory {...args} type="single" />;
};
Single.args = {
type: 'single',
type: 'single',
};
export const Multi = (args) => {
return <PickerCategory {...args} type="single" />;
return <PickerCategory {...args} type="single" />;
};
Multi.args = {
type: 'multi',
type: 'multi',
};
export const Wiki = (args) => {
return <PickerCategory {...args} wikiMode roleWikiData={roleWikiData} />;
return <PickerCategory {...args} wikiMode roleWikiData={roleWikiData} />;
};

View file

@ -1,20 +1,20 @@
import styled from 'styled-components';
export const Head = styled.div`
margin: 7px 5px;
line-height: 200%;
display: flex;
align-items: center;
justify-content: space-between;
margin: 7px 5px;
line-height: 200%;
display: flex;
align-items: center;
justify-content: space-between;
`;
export const HeadTitle = styled.div`
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
`;
export const HeadSub = styled.div`
flex-shrink: 0;
margin-top: -4px;
flex-shrink: 0;
margin-top: -4px;
`;

View file

@ -8,57 +8,57 @@ import styled from 'styled-components';
import { Head, HeadSub, HeadTitle } from './PickerCategory.styled';
export type CategoryProps = {
title: string;
roles: RPCRole[];
category: RPCCategory;
selectedRoles: string[];
onChange: (role: RPCRole) => (newState: boolean) => void;
type: 'single' | 'multi';
title: string;
roles: RPCRole[];
category: RPCCategory;
selectedRoles: string[];
onChange: (role: RPCRole) => (newState: boolean) => void;
type: 'single' | 'multi';
} & (
| {
wikiMode: true;
roleWikiData: { [roleId: string]: string };
}
| {
wikiMode: false;
}
| {
wikiMode: true;
roleWikiData: { [roleId: string]: string };
}
| {
wikiMode: false;
}
);
const Category = styled.div`
display: flex;
flex-wrap: wrap;
display: flex;
flex-wrap: wrap;
`;
const Container = styled.div`
overflow: hidden;
padding: 5px;
overflow: hidden;
padding: 5px;
`;
export const PickerCategory = (props: CategoryProps) => (
<div>
<Head>
<HeadTitle>
<LargeText>{props.title}</LargeText>
</HeadTitle>
{props.type === 'single' && (
<HeadSub>
<AmbientLarge>Pick one</AmbientLarge>
</HeadSub>
)}
</Head>
<Category>
{sortBy(props.roles, 'position').map((role, idx) => (
<Container key={idx}>
<Role
role={role}
selected={props.selectedRoles.includes(role.id)}
onClick={props.onChange(role)}
disabled={role.safety !== RoleSafety.Safe}
tooltipId={props.category.id}
/>
</Container>
))}
</Category>
<ReactTooltip id={props.category.id} />
</div>
<div>
<Head>
<HeadTitle>
<LargeText>{props.title}</LargeText>
</HeadTitle>
{props.type === 'single' && (
<HeadSub>
<AmbientLarge>Pick one</AmbientLarge>
</HeadSub>
)}
</Head>
<Category>
{sortBy(props.roles, 'position').map((role, idx) => (
<Container key={idx}>
<Role
role={role}
selected={props.selectedRoles.includes(role.id)}
onClick={props.onChange(role)}
disabled={role.safety !== RoleSafety.Safe}
tooltipId={props.category.id}
/>
</Container>
))}
</Category>
<ReactTooltip id={props.category.id} />
</div>
);