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
|
@ -8,95 +8,88 @@ import { DiscordUser, GuildSlug } from '@roleypoly/types';
|
|||
import * as React from 'react';
|
||||
import { GoOrganization } from 'react-icons/go';
|
||||
import {
|
||||
GuildPopoverHead,
|
||||
InteractionBase,
|
||||
MastheadA,
|
||||
MastheadAlignment,
|
||||
MastheadBase,
|
||||
MastheadLeft,
|
||||
MastheadRight,
|
||||
GuildPopoverHead,
|
||||
InteractionBase,
|
||||
MastheadA,
|
||||
MastheadAlignment,
|
||||
MastheadBase,
|
||||
MastheadLeft,
|
||||
MastheadRight,
|
||||
} from './Masthead.styled';
|
||||
|
||||
type Props = {
|
||||
user?: DiscordUser;
|
||||
activeGuildId: string | null;
|
||||
guilds: GuildSlug[];
|
||||
disableGuildPicker?: boolean;
|
||||
recentGuilds: string[];
|
||||
user?: DiscordUser;
|
||||
activeGuildId: string | null;
|
||||
guilds: GuildSlug[];
|
||||
disableGuildPicker?: boolean;
|
||||
recentGuilds: string[];
|
||||
};
|
||||
|
||||
export const Authed = (props: Props) => {
|
||||
const [userPopoverState, setUserPopoverState] = React.useState(false);
|
||||
const [serverPopoverState, setServerPopoverState] = React.useState(false);
|
||||
const [userPopoverState, setUserPopoverState] = React.useState(false);
|
||||
const [serverPopoverState, setServerPopoverState] = React.useState(false);
|
||||
|
||||
return (
|
||||
<MastheadBase>
|
||||
<MastheadAlignment>
|
||||
<MastheadLeft>
|
||||
<MastheadA to="/servers">
|
||||
<DynamicLogomark height={35} />
|
||||
</MastheadA>
|
||||
<InteractionBase
|
||||
onClick={() => {
|
||||
if (!props.disableGuildPicker) {
|
||||
setServerPopoverState(true);
|
||||
setUserPopoverState(false);
|
||||
}
|
||||
}}
|
||||
hide={!serverPopoverState}
|
||||
>
|
||||
<NavSlug
|
||||
guild={
|
||||
props.guilds.find(
|
||||
(guild) => guild.id === props.activeGuildId
|
||||
) || null
|
||||
}
|
||||
/>
|
||||
</InteractionBase>
|
||||
<Popover
|
||||
headContent={
|
||||
<GuildPopoverHead>
|
||||
<GoOrganization />
|
||||
My Guilds
|
||||
</GuildPopoverHead>
|
||||
}
|
||||
canDefocus
|
||||
position="bottom left"
|
||||
active={serverPopoverState}
|
||||
preferredWidth={560}
|
||||
onExit={() => setServerPopoverState(false)}
|
||||
>
|
||||
{() => (
|
||||
<GuildNav
|
||||
guilds={props.guilds}
|
||||
recentGuilds={props.recentGuilds || []}
|
||||
/>
|
||||
)}
|
||||
</Popover>
|
||||
</MastheadLeft>
|
||||
<MastheadRight>
|
||||
<InteractionBase
|
||||
onClick={() => {
|
||||
setUserPopoverState(true);
|
||||
setServerPopoverState(false);
|
||||
}}
|
||||
hide={!userPopoverState}
|
||||
>
|
||||
{props.user !== undefined && (
|
||||
<UserAvatarGroup user={props.user} />
|
||||
)}
|
||||
</InteractionBase>
|
||||
<Popover
|
||||
headContent={<></>}
|
||||
canDefocus
|
||||
position="top right"
|
||||
active={userPopoverState}
|
||||
onExit={() => setUserPopoverState(false)}
|
||||
>
|
||||
{() => props.user && <UserPopover user={props.user} />}
|
||||
</Popover>
|
||||
</MastheadRight>
|
||||
</MastheadAlignment>
|
||||
</MastheadBase>
|
||||
);
|
||||
return (
|
||||
<MastheadBase>
|
||||
<MastheadAlignment>
|
||||
<MastheadLeft>
|
||||
<MastheadA to="/servers">
|
||||
<DynamicLogomark height={35} />
|
||||
</MastheadA>
|
||||
<InteractionBase
|
||||
onClick={() => {
|
||||
if (!props.disableGuildPicker) {
|
||||
setServerPopoverState(true);
|
||||
setUserPopoverState(false);
|
||||
}
|
||||
}}
|
||||
hide={!serverPopoverState}
|
||||
>
|
||||
<NavSlug
|
||||
guild={
|
||||
props.guilds.find((guild) => guild.id === props.activeGuildId) || null
|
||||
}
|
||||
/>
|
||||
</InteractionBase>
|
||||
<Popover
|
||||
headContent={
|
||||
<GuildPopoverHead>
|
||||
<GoOrganization />
|
||||
My Guilds
|
||||
</GuildPopoverHead>
|
||||
}
|
||||
canDefocus
|
||||
position="bottom left"
|
||||
active={serverPopoverState}
|
||||
preferredWidth={560}
|
||||
onExit={() => setServerPopoverState(false)}
|
||||
>
|
||||
{() => (
|
||||
<GuildNav guilds={props.guilds} recentGuilds={props.recentGuilds || []} />
|
||||
)}
|
||||
</Popover>
|
||||
</MastheadLeft>
|
||||
<MastheadRight>
|
||||
<InteractionBase
|
||||
onClick={() => {
|
||||
setUserPopoverState(true);
|
||||
setServerPopoverState(false);
|
||||
}}
|
||||
hide={!userPopoverState}
|
||||
>
|
||||
{props.user !== undefined && <UserAvatarGroup user={props.user} />}
|
||||
</InteractionBase>
|
||||
<Popover
|
||||
headContent={<></>}
|
||||
canDefocus
|
||||
position="top right"
|
||||
active={userPopoverState}
|
||||
onExit={() => setUserPopoverState(false)}
|
||||
>
|
||||
{() => props.user && <UserPopover user={props.user} />}
|
||||
</Popover>
|
||||
</MastheadRight>
|
||||
</MastheadAlignment>
|
||||
</MastheadBase>
|
||||
);
|
||||
};
|
||||
|
|
|
@ -3,32 +3,28 @@ import { Button } from '@roleypoly/design-system/atoms/button';
|
|||
import * as React from 'react';
|
||||
import { FaSignInAlt } from 'react-icons/fa';
|
||||
import {
|
||||
MastheadA,
|
||||
MastheadAlignment,
|
||||
MastheadBase,
|
||||
MastheadLeft,
|
||||
MastheadRight,
|
||||
MastheadA,
|
||||
MastheadAlignment,
|
||||
MastheadBase,
|
||||
MastheadLeft,
|
||||
MastheadRight,
|
||||
} from './Masthead.styled';
|
||||
|
||||
export const Guest = () => (
|
||||
<MastheadBase>
|
||||
<MastheadAlignment>
|
||||
<MastheadLeft>
|
||||
<MastheadA to="/">
|
||||
<DynamicLogotype height={30} />
|
||||
</MastheadA>
|
||||
</MastheadLeft>
|
||||
<MastheadRight>
|
||||
<MastheadA to="/auth/login">
|
||||
<Button size="small">
|
||||
Login{' '}
|
||||
<FaSignInAlt
|
||||
size="1em"
|
||||
style={{ transform: 'translateY(1px)' }}
|
||||
/>
|
||||
</Button>
|
||||
</MastheadA>
|
||||
</MastheadRight>
|
||||
</MastheadAlignment>
|
||||
</MastheadBase>
|
||||
<MastheadBase>
|
||||
<MastheadAlignment>
|
||||
<MastheadLeft>
|
||||
<MastheadA to="/">
|
||||
<DynamicLogotype height={30} />
|
||||
</MastheadA>
|
||||
</MastheadLeft>
|
||||
<MastheadRight>
|
||||
<MastheadA to="/auth/login">
|
||||
<Button size="small">
|
||||
Login <FaSignInAlt size="1em" style={{ transform: 'translateY(1px)' }} />
|
||||
</Button>
|
||||
</MastheadA>
|
||||
</MastheadRight>
|
||||
</MastheadAlignment>
|
||||
</MastheadBase>
|
||||
);
|
||||
|
|
|
@ -4,11 +4,11 @@ import { Authed } from './Authed';
|
|||
import { Guest } from './Guest';
|
||||
|
||||
export default {
|
||||
title: 'Organisms/Masthead',
|
||||
title: 'Organisms/Masthead',
|
||||
};
|
||||
|
||||
export const HasGuilds = () => (
|
||||
<Authed guilds={mastheadSlugs} activeGuildId={guild.id} user={user} />
|
||||
<Authed guilds={mastheadSlugs} activeGuildId={guild.id} user={user} />
|
||||
);
|
||||
|
||||
export const NoGuilds = () => <Authed guilds={[]} activeGuildId={null} user={user} />;
|
||||
|
|
|
@ -5,89 +5,89 @@ import { transitions } from '@roleypoly/design-system/atoms/timings';
|
|||
import styled, { css } from 'styled-components';
|
||||
|
||||
export const MastheadBase = styled.div`
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
height: 50px;
|
||||
background-color: ${palette.taupe100};
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 0 3px;
|
||||
z-index: 100;
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
height: 50px;
|
||||
background-color: ${palette.taupe100};
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 0 3px;
|
||||
z-index: 100;
|
||||
`;
|
||||
|
||||
export const MastheadAlignment = styled.div`
|
||||
max-width: 98vw;
|
||||
width: 1024px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
max-width: 98vw;
|
||||
width: 1024px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
`;
|
||||
|
||||
const sideBase = styled.div`
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex: 1;
|
||||
display: flex;
|
||||
`;
|
||||
|
||||
export const MastheadLeft = styled(sideBase)``;
|
||||
|
||||
export const MastheadRight = styled(sideBase)`
|
||||
flex: 0;
|
||||
justify-content: flex-end;
|
||||
flex: 0;
|
||||
justify-content: flex-end;
|
||||
`;
|
||||
|
||||
export const MastheadCollapse = styled.div`
|
||||
${onSmallScreen(css`
|
||||
display: none;
|
||||
`)}
|
||||
${onSmallScreen(css`
|
||||
display: none;
|
||||
`)}
|
||||
`;
|
||||
|
||||
export const MastheadInner = styled.div`
|
||||
/* height: 30px; */
|
||||
display: flex;
|
||||
align-items: center;
|
||||
/* height: 30px; */
|
||||
display: flex;
|
||||
align-items: center;
|
||||
`;
|
||||
|
||||
type InteractionBaseProps = {
|
||||
hide: boolean;
|
||||
hide: boolean;
|
||||
};
|
||||
export const InteractionBase = styled.div<InteractionBaseProps>`
|
||||
display: flex;
|
||||
align-items: center;
|
||||
height: 50px;
|
||||
padding: 0 5px;
|
||||
transition: opacity ${transitions.actionable}s ease-in-out,
|
||||
background-color ${transitions.actionable}s ease-in-out;
|
||||
opacity: ${(props) => (props.hide ? 1 : 0)};
|
||||
display: flex;
|
||||
align-items: center;
|
||||
height: 50px;
|
||||
padding: 0 5px;
|
||||
transition: opacity ${transitions.actionable}s ease-in-out,
|
||||
background-color ${transitions.actionable}s ease-in-out;
|
||||
opacity: ${(props) => (props.hide ? 1 : 0)};
|
||||
|
||||
:hover {
|
||||
background-color: rgba(0, 0, 0, 0.15);
|
||||
cursor: pointer;
|
||||
}
|
||||
:hover {
|
||||
background-color: rgba(0, 0, 0, 0.15);
|
||||
cursor: pointer;
|
||||
}
|
||||
`;
|
||||
|
||||
export const MastheadA = styled(Link)`
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
color: unset;
|
||||
text-decoration: unset;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
color: unset;
|
||||
text-decoration: unset;
|
||||
`;
|
||||
|
||||
export const GuildPopoverHead = styled.div`
|
||||
display: flex;
|
||||
align-items: center;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
svg {
|
||||
color: ${palette.taupe500};
|
||||
padding: 5px;
|
||||
height: 1.4em;
|
||||
font-size: 2em;
|
||||
margin-right: 10px;
|
||||
margin-left: 16px;
|
||||
${onSmallScreen(css`
|
||||
margin-left: 0;
|
||||
`)}
|
||||
}
|
||||
svg {
|
||||
color: ${palette.taupe500};
|
||||
padding: 5px;
|
||||
height: 1.4em;
|
||||
font-size: 2em;
|
||||
margin-right: 10px;
|
||||
margin-left: 16px;
|
||||
${onSmallScreen(css`
|
||||
margin-left: 0;
|
||||
`)}
|
||||
}
|
||||
`;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue