mirror of
https://github.com/roleypoly/roleypoly.git
synced 2025-06-16 09:39:09 +00:00
chore: update prettier tab width for consistency (#175)
This commit is contained in:
parent
a931f8c69c
commit
f24d2fcc99
247 changed files with 7224 additions and 7375 deletions
|
@ -3,8 +3,8 @@ import { HelpStoryWrapper } from '../../molecules/help-page-base/storyDecorator'
|
|||
import { WhyNoRoles } from './WhyNoRoles';
|
||||
|
||||
export default {
|
||||
title: 'Organisms/Help Pages',
|
||||
decorators: [HelpStoryWrapper],
|
||||
title: 'Organisms/Help Pages',
|
||||
decorators: [HelpStoryWrapper],
|
||||
};
|
||||
|
||||
export const WhyNoRoles_ = () => <WhyNoRoles />;
|
||||
|
|
|
@ -3,37 +3,36 @@ import { Role } from '@roleypoly/types';
|
|||
import styled, { css } from 'styled-components';
|
||||
|
||||
export const DiscordBase = styled.div`
|
||||
background-color: ${palette.discord100};
|
||||
border: solid 1px rgba(0, 0, 0, 0.15);
|
||||
border-radius: 3px;
|
||||
padding: 10px;
|
||||
user-select: none;
|
||||
width: 250px;
|
||||
background-color: ${palette.discord100};
|
||||
border: solid 1px rgba(0, 0, 0, 0.15);
|
||||
border-radius: 3px;
|
||||
padding: 10px;
|
||||
user-select: none;
|
||||
width: 250px;
|
||||
`;
|
||||
|
||||
const hover = (roleColor: string) => css`
|
||||
color: #efefef;
|
||||
background-color: ${roleColor};
|
||||
cursor: pointer;
|
||||
color: #efefef;
|
||||
background-color: ${roleColor};
|
||||
cursor: pointer;
|
||||
`;
|
||||
|
||||
export const DiscordRole = styled.div<{
|
||||
discordRole: Role;
|
||||
isRoleypoly: boolean;
|
||||
discordRole: Role;
|
||||
isRoleypoly: boolean;
|
||||
}>`
|
||||
/* stylelint-disable function-name-case, function-whitespace-after */
|
||||
/* stylelint-disable function-name-case, function-whitespace-after */
|
||||
|
||||
/* Disabled due to postcss bug parsing the below functions as CSS and not a JS interpolation */
|
||||
/* Disabled due to postcss bug parsing the below functions as CSS and not a JS interpolation */
|
||||
|
||||
padding: 6px 10px;
|
||||
color: ${(props) => numberToChroma(props.discordRole.color).css()};
|
||||
border-radius: 3px;
|
||||
padding: 6px 10px;
|
||||
color: ${(props) => numberToChroma(props.discordRole.color).css()};
|
||||
border-radius: 3px;
|
||||
|
||||
:hover {
|
||||
${(props) => hover(numberToChroma(props.discordRole.color).alpha(0.5).css())}
|
||||
}
|
||||
:hover {
|
||||
${(props) => hover(numberToChroma(props.discordRole.color).alpha(0.5).css())}
|
||||
}
|
||||
|
||||
${(props) =>
|
||||
props.isRoleypoly &&
|
||||
hover(numberToChroma(props.discordRole.color).alpha(0.5).css())}
|
||||
${(props) =>
|
||||
props.isRoleypoly && hover(numberToChroma(props.discordRole.color).alpha(0.5).css())}
|
||||
`;
|
||||
|
|
|
@ -9,34 +9,34 @@ import { FaCheck, FaTimes } from 'react-icons/fa';
|
|||
import { DiscordBase, DiscordRole } from './WhyNoRoles.styled';
|
||||
|
||||
const adminRoles: Role[] = [
|
||||
{
|
||||
id: 'roley2',
|
||||
name: 'Admin',
|
||||
permissions: '0',
|
||||
color: chroma('hotpink').num(),
|
||||
position: -1,
|
||||
managed: true,
|
||||
safety: 0,
|
||||
},
|
||||
{
|
||||
id: 'roley3',
|
||||
name: 'Moderator',
|
||||
permissions: '0',
|
||||
color: chroma('lime').num(),
|
||||
position: -1,
|
||||
managed: true,
|
||||
safety: 0,
|
||||
},
|
||||
];
|
||||
|
||||
const roleypolyRole: Role = {
|
||||
id: 'roley',
|
||||
name: 'Roleypoly',
|
||||
{
|
||||
id: 'roley2',
|
||||
name: 'Admin',
|
||||
permissions: '0',
|
||||
color: chroma(palette.taupe500).num(),
|
||||
color: chroma('hotpink').num(),
|
||||
position: -1,
|
||||
managed: true,
|
||||
safety: 0,
|
||||
},
|
||||
{
|
||||
id: 'roley3',
|
||||
name: 'Moderator',
|
||||
permissions: '0',
|
||||
color: chroma('lime').num(),
|
||||
position: -1,
|
||||
managed: true,
|
||||
safety: 0,
|
||||
},
|
||||
];
|
||||
|
||||
const roleypolyRole: Role = {
|
||||
id: 'roley',
|
||||
name: 'Roleypoly',
|
||||
permissions: '0',
|
||||
color: chroma(palette.taupe500).num(),
|
||||
position: -1,
|
||||
managed: true,
|
||||
safety: 0,
|
||||
};
|
||||
|
||||
const goodRoles = [...adminRoles, roleypolyRole, ...demoData];
|
||||
|
@ -44,40 +44,40 @@ const goodRoles = [...adminRoles, roleypolyRole, ...demoData];
|
|||
const badRoles = [...adminRoles, ...demoData, roleypolyRole];
|
||||
|
||||
const MaybeWithOverlay = (props: { children: React.ReactNode; withOverlay: boolean }) => {
|
||||
if (props.withOverlay) {
|
||||
return (
|
||||
<SparkleOverlay size={-5} repeatCount={10}>
|
||||
{props.children}
|
||||
</SparkleOverlay>
|
||||
);
|
||||
} else {
|
||||
return <>{props.children}</>;
|
||||
}
|
||||
if (props.withOverlay) {
|
||||
return (
|
||||
<SparkleOverlay size={-5} repeatCount={10}>
|
||||
{props.children}
|
||||
</SparkleOverlay>
|
||||
);
|
||||
} else {
|
||||
return <>{props.children}</>;
|
||||
}
|
||||
};
|
||||
|
||||
const Example = (props: { roles: Role[]; isGood: boolean }) => (
|
||||
<div>
|
||||
<DiscordBase>
|
||||
{props.roles.map((r) => (
|
||||
<MaybeWithOverlay withOverlay={props.isGood && r.name === 'Roleypoly'}>
|
||||
<DiscordRole discordRole={r} isRoleypoly={r.name === 'Roleypoly'}>
|
||||
{r.name}
|
||||
</DiscordRole>
|
||||
</MaybeWithOverlay>
|
||||
))}
|
||||
</DiscordBase>
|
||||
</div>
|
||||
<div>
|
||||
<DiscordBase>
|
||||
{props.roles.map((r) => (
|
||||
<MaybeWithOverlay withOverlay={props.isGood && r.name === 'Roleypoly'}>
|
||||
<DiscordRole discordRole={r} isRoleypoly={r.name === 'Roleypoly'}>
|
||||
{r.name}
|
||||
</DiscordRole>
|
||||
</MaybeWithOverlay>
|
||||
))}
|
||||
</DiscordBase>
|
||||
</div>
|
||||
);
|
||||
|
||||
export const WhyNoRoles = () => (
|
||||
<HalfsiesContainer>
|
||||
<HalfsiesItem>
|
||||
<FaCheck /> Good
|
||||
<Example isGood roles={goodRoles} />
|
||||
</HalfsiesItem>
|
||||
<HalfsiesItem>
|
||||
<FaTimes /> Baddd
|
||||
<Example isGood={false} roles={badRoles} />
|
||||
</HalfsiesItem>
|
||||
</HalfsiesContainer>
|
||||
<HalfsiesContainer>
|
||||
<HalfsiesItem>
|
||||
<FaCheck /> Good
|
||||
<Example isGood roles={goodRoles} />
|
||||
</HalfsiesItem>
|
||||
<HalfsiesItem>
|
||||
<FaTimes /> Baddd
|
||||
<Example isGood={false} roles={badRoles} />
|
||||
</HalfsiesItem>
|
||||
</HalfsiesContainer>
|
||||
);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue