Skip to content

Commit

Permalink
fix: make font-size consistent
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewinci committed Mar 15, 2023
1 parent fb73804 commit 7e116fd
Show file tree
Hide file tree
Showing 8 changed files with 81 additions and 84 deletions.
61 changes: 61 additions & 0 deletions src/components.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
import styled from "@emotion/styled";

const fontSizes = {
xl: "35px",
l: "23px",
s: "18px",
xs: "14px",
};

type TextProps = {
size: "xl" | "l" | "s" | "xs";
margin?: string;
};

export const Text = styled.p<TextProps>`
font-size: ${(props) => fontSizes[props.size]};
margin: ${(props) => props.margin ?? "0"};
`;

export const Input = styled.input`
font-family: virgil;
padding: 3px;
text-align: center;
background-color: #ffffff;
font-size: ${fontSizes.xs};
border-radius: 4px;
color: black;
margin-left: 5px;
margin-right: 5px;
`;

type GroupProps = {
justifyContent?: "center" | "space-between";
maxHeight?: number;
margin?: string;
padding?: string;
};

export const Group = styled.div<GroupProps>`
display: flex;
justify-content: ${(props) => props.justifyContent ?? "center"};
max-height: ${(props) =>
props.maxHeight ? `${props.maxHeight}px` : undefined};
margin: ${(props) => props.margin ?? undefined};
padding: ${(props) => props.padding ?? undefined};
`;

export const Button = styled.button`
font-family: virgil;
padding: 3px 10px;
background-color: #ffffff;
font-size: ${fontSizes.xs};
border-radius: 4px;
color: black;
margin-left: 5px;
margin-right: 5px;
&:hover {
color: #ffffff;
background-color: black;
}
`;
16 changes: 0 additions & 16 deletions src/components/button.tsx

This file was deleted.

12 changes: 0 additions & 12 deletions src/components/container.tsx

This file was deleted.

5 changes: 0 additions & 5 deletions src/components/index.ts

This file was deleted.

13 changes: 0 additions & 13 deletions src/components/input.tsx

This file was deleted.

17 changes: 0 additions & 17 deletions src/components/text.tsx

This file was deleted.

15 changes: 0 additions & 15 deletions src/components/title-bar.tsx

This file was deleted.

26 changes: 20 additions & 6 deletions src/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,37 @@ import { css, Global } from '@emotion/react'
import styled from '@emotion/styled'
import React from 'react'
import ReactDOM from 'react-dom/client'
import { Button, Group, Input, TitleBar, Text } from './components'
import { Button, Group, Input, Text } from './components'
import { floppy, sword } from './icons'
import { GlobalStyles } from './style'

const TitleBar = () => {
return <>
<Group padding='0'>
<img style={{ width: "25px", marginRight: "10px" }} src={sword} />
<Text size="xl" margin="0">Excalistore</Text>
<img style={{ width: "35px", marginLeft: "10px" }} src={floppy} />
</Group>
<Group margin='0' padding='0' >
<Text size="s" margin="0">The Excalidraw drawings manager</Text>
</Group>
</>
}

const DrawingItem = ({ name, date }: { name: string, date: string }) => {
const ItemContainer = styled.div`
border: 1px solid black;
padding: 0px 10px;
`;
return <ItemContainer>
<Text margin={10} size='s'>{name}</Text>
<Text margin="4px 5px" size='s'>{name}</Text>
<Group justifyContent="space-between">
<Group maxHeight={30}>
<Button>Open</Button>
<Button>Update</Button>
<Button>Bin it</Button>
</Group>
<Text size='s' margin={5}>{date}</Text>
<Text size='s' margin="5px 0px">{date}</Text>
</Group>
</ItemContainer>
}
Expand All @@ -28,12 +42,12 @@ ReactDOM.createRoot(document.getElementById('root') as HTMLElement).render(
<React.StrictMode>
<Global styles={GlobalStyles} />
<TitleBar />
<Group style={{ marginTop: "10px" }}>
<Group margin="25px 0 25px 0">
<Input style={{ minWidth: "320px" }} placeholder='drawing title'></Input>
<Button>Save drawing</Button>
</Group>
<Group>
<h2 style={{ fontSize: "23px", marginBottom: "5px" }}>My drawings</h2>
<Group margin='0px 0px 5px 0'>
<Text size='l'>My drawings</Text>
</Group>
<div style={{ maxHeight: "245px", minHeight: "245px", overflow: "scroll", border: "2px solid black", borderRadius: "4px" }}>
<DrawingItem name="My awesome drawing" date='01/01/2023' />
Expand Down

0 comments on commit 7e116fd

Please sign in to comment.