Skip to content

Commit

Permalink
feat: add title and button components
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewinci committed Mar 14, 2023
1 parent 89d116c commit df19720
Show file tree
Hide file tree
Showing 8 changed files with 291 additions and 7 deletions.
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
"preview": "vite preview"
},
"dependencies": {
"@emotion/react": "^11.10.6",
"@emotion/styled": "^11.10.6",
"react": "^18.2.0",
"react-dom": "^18.2.0"
},
Expand All @@ -19,4 +21,4 @@
"typescript": "^4.9.3",
"vite": "^4.1.0"
}
}
}
14 changes: 14 additions & 0 deletions src/components/button.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import styled from '@emotion/styled'

export const Button = styled.button`
font-family: virgil;
padding: 10px;
background-color: #ffffff;
font-size: 20px;
border-radius: 4px;
color: black;
&:hover {
color: #ffffff;
background-color: black;
}
`
2 changes: 2 additions & 0 deletions src/components/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export * from "./button";
export * from "./typography";
8 changes: 8 additions & 0 deletions src/components/typography.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import styled from "@emotion/styled";

export const Title = styled.h1`
font-family: virgil;
font-weight: bolder;
font-size: 3em;
margin: 2px;
`
Binary file added src/fonts/Virgil.woff2
Binary file not shown.
9 changes: 9 additions & 0 deletions src/fonts/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { css } from "@emotion/react";
import virgil from "./Virgil.woff2";

export const GlobalStyles = css`
@font-face {
font-family: "virgil";
src: url(${virgil}) format("woff2");
}
`;
10 changes: 8 additions & 2 deletions src/main.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
// entry point of the react app that powers the extension pop-up
import { Global } from '@emotion/react'
import React from 'react'
import ReactDOM from 'react-dom/client'
import { Button, Title } from './components'
import { GlobalStyles } from './fonts'

ReactDOM.createRoot(document.getElementById('root') as HTMLElement).render(
<React.StrictMode>
<h1>Hello!</h1>
<Global styles={GlobalStyles} />
<Title>Hello!</Title>
<Button>This is a test</Button>
</React.StrictMode>,
)
)
Loading

0 comments on commit df19720

Please sign in to comment.