arch: move web folder into api & move api to top level

This commit is contained in:
Jordan Knott
2020-07-04 18:08:37 -05:00
parent eaffaa70df
commit e5d5e6da01
354 changed files with 20 additions and 1557 deletions

View File

@ -0,0 +1,45 @@
import React, { useRef } from 'react';
import styled from 'styled-components';
export const Container = styled.div<{ size: number | string; bgColor: string | null; backgroundURL: string | null }>`
width: ${props => props.size}px;
height: ${props => props.size}px;
border-radius: 9999px;
display: flex;
align-items: center;
justify-content: center;
color: #fff;
font-weight: 700;
background: ${props => (props.backgroundURL ? `url(${props.backgroundURL})` : props.bgColor)};
background-position: center;
background-size: contain;
`;
type ProfileIconProps = {
user: TaskUser;
onProfileClick: ($target: React.RefObject<HTMLElement>, user: TaskUser) => void;
size: number | string;
};
const ProfileIcon: React.FC<ProfileIconProps> = ({ user, onProfileClick, size }) => {
const $profileRef = useRef<HTMLDivElement>(null);
return (
<Container
ref={$profileRef}
onClick={() => {
onProfileClick($profileRef, user);
}}
size={size}
backgroundURL={user.profileIcon.url ?? null}
bgColor={user.profileIcon.bgColor ?? null}
>
{(!user.profileIcon.url && user.profileIcon.initials) ?? ''}
</Container>
);
};
ProfileIcon.defaultProps = {
size: 28,
};
export default ProfileIcon;