diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 6c347c0..63e576d 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -15,7 +15,7 @@ jobs: - name: Install and Build 🔧 # This example project is built using npm and outputs the result to the 'build' folder. Replace with the commands required to build your project, or remove this step entirely if your site is pre-built. run: | yarn install - yarn build + NODE_ENV=production yarn build - name: Deploy 🚀 uses: JamesIves/github-pages-deploy-action@3.5.9 diff --git a/src/App.tsx b/src/App.tsx index 0bdf98a..02a0fdc 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -8,8 +8,8 @@ import AppRouter from './Router'; const App: React.FC = () => ( - - + + diff --git a/src/Router.tsx b/src/Router.tsx index 6adbae5..ee7f0e8 100644 --- a/src/Router.tsx +++ b/src/Router.tsx @@ -6,6 +6,7 @@ import { } from 'react-router-dom'; import Encrypt from './screens/Encrypt'; +import Welcome from './screens/Welcome'; import Debug from './screens/Debug'; const AppRouter: React.FC = () => ( @@ -14,6 +15,9 @@ const AppRouter: React.FC = () => ( + + + diff --git a/src/components/Add.tsx b/src/components/Add.tsx index c3dc6a0..541e37b 100644 --- a/src/components/Add.tsx +++ b/src/components/Add.tsx @@ -1,46 +1,22 @@ -import React, { Fragment, useState } from 'react'; -import { Menu, Dropdown, Form } from 'antd'; -import { DownOutlined, FileOutlined, FileTextOutlined } from '@ant-design/icons'; +import React, { useState } from 'react'; +import { Radio, Divider } from 'antd'; +import { FileOutlined, FileTextOutlined } from '@ant-design/icons'; import AddText from './AddText'; import AddFile from './AddFile'; -const layout = { - labelCol: { span: 2 }, -}; +const DEFAULT_VALUE = 'text'; const Add: React.FC = () => { - const [type, setType] = useState<'file' | 'text'>('text'); - - const menu = ( - - setType('file')} - active={type === 'file'} - icon={} - > - File - - setType('text')} - active={type === 'text'} - icon={} - > - Text - - - ); + const [type, setType] = useState<'file' | 'text'>(DEFAULT_VALUE); return ( <> -
- - - {type} - - -
+ + setType(evt.target.value)} defaultValue={DEFAULT_VALUE}> + Text + File + + {type === 'text' && } {type === 'file' && } diff --git a/src/components/AddFile.tsx b/src/components/AddFile.tsx index 75fb308..b3e5b68 100644 --- a/src/components/AddFile.tsx +++ b/src/components/AddFile.tsx @@ -1,12 +1,13 @@ import React, { useContext, useCallback } from 'react'; import styled from 'styled-components'; import { Layout } from 'antd'; -import { UploadOutlined } from '@ant-design/icons'; +import { FileAddTwoTone } from '@ant-design/icons'; import { useDropzone } from 'react-dropzone'; import EncryptionContext from '../contexts/Encryption'; -const Icon = styled(UploadOutlined)` +const Icon = styled(FileAddTwoTone)` font-size: 100px; + margin-bottom: 20px; `; const DropWrapper = styled(Layout)` diff --git a/src/components/AddText.tsx b/src/components/AddText.tsx index 0ce67cf..79f96a1 100644 --- a/src/components/AddText.tsx +++ b/src/components/AddText.tsx @@ -3,14 +3,6 @@ import { Input, Form, Button } from 'antd'; import { PlusOutlined } from '@ant-design/icons'; import EncryptionContext from '../contexts/Encryption'; -const layout = { - labelCol: { span: 2 }, -}; - -const tailLayout = { - wrapperCol: { offset: 2 }, -}; - const AddText : React.FC = () => { const { addText } = useContext(EncryptionContext); const [name, setName] = useState(''); @@ -23,25 +15,23 @@ const AddText : React.FC = () => { }, [text, addText]); return ( -
- + + setName(evt.target.value)} /> - + setText(evt.target.value)} /> - + + + + + + + ); +}; + +export default Welcome; diff --git a/webpack.config.ts b/webpack.config.ts index d99ad07..91e0aa4 100644 --- a/webpack.config.ts +++ b/webpack.config.ts @@ -1,12 +1,14 @@ -import webpack, { Configuration } from 'webpack'; +import { Configuration } from 'webpack'; import HtmlWebpackPlugin from 'html-webpack-plugin'; import path from 'path'; +const __DEV__ = process.env.NODE_ENV !== 'production'; + const config: Configuration = { - mode: 'development', + mode: __DEV__ ? 'development' : 'production', entry: { app: [ - 'react-hot-loader/patch', + ...(__DEV__ ? ['react-hot-loader/patch'] : []), path.join(__dirname, 'src', 'index.tsx'), ], }, @@ -20,7 +22,10 @@ const config: Configuration = { }, }, plugins: [ - new HtmlWebpackPlugin(), + new HtmlWebpackPlugin({ + title: 'Parcel', + minify: true, + }), ], module: { rules: [{