mirror of
https://github.com/roleypoly/roleypoly.git
synced 2025-07-01 16:26:57 +00:00
feat(design-system): pre-port of roleypoly/ui
This commit is contained in:
parent
c41fcabfd0
commit
ea2683da00
98 changed files with 2339 additions and 0 deletions
|
@ -0,0 +1,13 @@
|
|||
import { user } from 'hack/fixtures/storyData';
|
||||
import { moleculeStories } from 'molecules/molecules.story';
|
||||
import * as React from 'react';
|
||||
import { UserPopover } from './UserPopover';
|
||||
import { PopoverBase } from 'atoms/popover/Popover.styled';
|
||||
|
||||
const story = moleculeStories('User Popover', module);
|
||||
|
||||
story.add('User Popover', () => (
|
||||
<PopoverBase active>
|
||||
<UserPopover user={user} />
|
||||
</PopoverBase>
|
||||
));
|
|
@ -0,0 +1,33 @@
|
|||
import styled from 'styled-components';
|
||||
import { palette } from 'atoms/colors';
|
||||
import { transitions } from 'atoms/timings';
|
||||
|
||||
export const Base = styled.div`
|
||||
text-align: right;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
user-select: none;
|
||||
`;
|
||||
|
||||
export const NavAction = styled.div`
|
||||
height: 2.25em;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: flex-end;
|
||||
transition: color ${transitions.actionable}s ease-in-out;
|
||||
color: ${palette.taupe500};
|
||||
box-sizing: border-box;
|
||||
|
||||
&:hover {
|
||||
cursor: pointer;
|
||||
color: ${palette.taupe600};
|
||||
}
|
||||
|
||||
svg {
|
||||
font-size: 120%;
|
||||
box-sizing: content-box;
|
||||
padding: 5px 8px;
|
||||
position: relative;
|
||||
top: 0.1em;
|
||||
}
|
||||
`;
|
30
src/design-system/molecules/user-popover/UserPopover.tsx
Normal file
30
src/design-system/molecules/user-popover/UserPopover.tsx
Normal file
|
@ -0,0 +1,30 @@
|
|||
import * as React from 'react';
|
||||
import { DiscordUser } from '@roleypoly/rpc/shared';
|
||||
import { UserAvatarGroup } from 'molecules/user-avatar-group';
|
||||
import { Base, NavAction } from './UserPopover.styled';
|
||||
import { GoGear, GoSignOut } from 'react-icons/go';
|
||||
import Link from 'next/link';
|
||||
|
||||
type UserPopoverProps = {
|
||||
user: DiscordUser.AsObject;
|
||||
};
|
||||
|
||||
export const UserPopover = (props: UserPopoverProps) => (
|
||||
<Base>
|
||||
<UserAvatarGroup user={props.user} preventCollapse={true} />
|
||||
<NavAction>
|
||||
<Link href="/user/settings">
|
||||
<>
|
||||
Settings <GoGear />
|
||||
</>
|
||||
</Link>
|
||||
</NavAction>
|
||||
<NavAction>
|
||||
<Link href="/auth/machinery/logout">
|
||||
<>
|
||||
Log Out <GoSignOut />
|
||||
</>
|
||||
</Link>
|
||||
</NavAction>
|
||||
</Base>
|
||||
);
|
1
src/design-system/molecules/user-popover/index.ts
Normal file
1
src/design-system/molecules/user-popover/index.ts
Normal file
|
@ -0,0 +1 @@
|
|||
export * from './UserPopover';
|
Loading…
Add table
Add a link
Reference in a new issue