13 |
Welcome, {context.currentUser ? context.currentUser.displayName : "Anonymous"}!
14 |
This app is UNDER CONSTRUCTION.
15 |
16 | )
17 | }
18 | })
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Firebase / TypeScript / styled-components / Authenticated Routes / create-react-app / Navi / React / Oh my...
2 |
3 | You'll need to create a `.env.local` file with your firebase settings:
4 |
5 | ```text
6 | REACT_APP_API_KEY=
7 | REACT_APP_AUTH_DOMAIN=
8 | REACT_APP_DATABASE_URL=
9 | REACT_APP_PROJECT_ID=
10 | REACT_APP_STORAGE_BUCKET=
11 | REACT_APP_MESSAGING_SENDER_ID=
12 | ```
13 |
14 | Then:
15 |
16 | ```bash
17 | # Install dependencies
18 | npm install
19 |
20 | # Start the dev server
21 | npm start
22 |
23 | # Have fun!
24 | echo "🎉🎉🎉"
25 | ```
--------------------------------------------------------------------------------
/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "es5",
4 | "lib": [
5 | "dom",
6 | "dom.iterable",
7 | "esnext"
8 | ],
9 | "allowJs": true,
10 | "skipLibCheck": true,
11 | "esModuleInterop": true,
12 | "allowSyntheticDefaultImports": true,
13 | "forceConsistentCasingInFileNames": true,
14 | "module": "esnext",
15 | "moduleResolution": "node",
16 | "resolveJsonModule": true,
17 | "isolatedModules": true,
18 | "noEmit": true,
19 | "jsx": "preserve",
20 | "strict": true
21 | },
22 | "include": [
23 | "src"
24 | ]
25 | }
26 |
--------------------------------------------------------------------------------
/src/GlobalStyle.tsx:
--------------------------------------------------------------------------------
1 | import { createGlobalStyle } from 'styled-components/macro'
2 | import { base, colors } from './utils/theme'
3 |
4 | const GlobalStyle = createGlobalStyle`
5 | @import url('https://fonts.googleapis.com/css?family=Lato:300,400,400i,700,900|Inconsolata:400,700');
6 |
7 | * {
8 | box-sizing: border-box;
9 | }
10 |
11 | html {
12 | font-family: Lato, sans-serif;
13 | font-size: ${base};
14 | }
15 |
16 | body {
17 | color: ${colors.text};
18 | margin: 0;
19 | padding: 0;
20 | font-size: 1rem;
21 | line-height: 1.5rem;
22 | }
23 | `
24 |
25 | export default GlobalStyle
--------------------------------------------------------------------------------
/src/styled/Input.tsx:
--------------------------------------------------------------------------------
1 | import styled from 'styled-components'
2 | import { fontSizes, radius, colors, radiuses, boxShadows, durations } from '../utils/theme';
3 |
4 | const Input = styled.input`
5 | appearance: none;
6 | display: block;
7 | width: 100%;
8 | font-family: inherit;
9 | margin: 0;
10 | padding: 0.75rem;
11 | font-size: ${fontSizes.bodySmall1};
12 | border-radius: ${radiuses.large};
13 | border: 1px solid ${colors.white};
14 | background-color: ${colors.lighterGray};
15 | box-shadow: ${boxShadows[2]} inset;
16 | transition: border ${durations.short} linear;
17 | color: ${colors.lightBlack};
18 |
19 | &::placeholder{
20 | color: ${colors.borderGray};
21 | }
22 | &:focus{
23 | outline: none !important;
24 | border-color: ${colors.red};
25 | }
26 |
27 | ::-ms-clear {
28 | display: none;
29 | }
30 | `
31 |
32 | export default Input
--------------------------------------------------------------------------------
/src/controls/Gravatar.tsx:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import md5 from 'blueimp-md5'
3 | import { Omit } from '../types/Omit'
4 |
5 | interface GravatarOptions {
6 | email: string
7 | size: string | number
8 | defaultURL?: string
9 | }
10 |
11 | function getGravatarURL({
12 | email,
13 | size,
14 | defaultURL = 'identicon',
15 | }: GravatarOptions) {
16 | let hash = md5(email.toLowerCase().trim())
17 | return `https://www.gravatar.com/avatar/${hash}.jpg?s=${size}&d=${encodeURIComponent(
18 | defaultURL,
19 | )}`
20 | }
21 |
22 | export interface GravatarProps
23 | extends GravatarOptions,
24 | Omit