- Initialize project using Create React App,
npx create-react-app my-app --template typescript
. - Delete useless files and erase all uselsess codes in them. In my case, delete all the files except
App.tsx
andindex.tsx
. - Create a directory called
models
. - Create
atoms.ts
file inmodels
directory and define global states. - Install react-router-dom via npm,
npm i react-router-dom
. - Install react-beautiful-dnd via npm,
npm i react-beautiful-dnd
. - Create a directory called
routes
. - Create
Home.tsx
file inroutes
directory and defineDragDropContext
andDroppable
fortype={"boards"}
. - Create
Router.tsx
file in root directory and define route forHome.tsx
. - Create a directory called
components
. - Create
Board.tsx
,Task.tsx
,TaskTrashCan.tsx
andAddBoard.tsx
incomponents
directory. - Define
Board
component asDraggable
inBoards.tsx
and addDroppable
for tasks inside. - Define
AddBoard
andTask
component asDraggable
inAddBoard.tsx
andTask.tsx
. - Define
TaskTrashCan
component asDroppable
inTaskTrashCan.tsx
. - Add
TaskTrashCan
belowDragDropContext
opening tag. - Add
Board
andAddBoard
in theDroppable
area oftype={"boards"}
inHome
. - Add
Task
in theDroppable
area of default type inBoard
. - Place all the parameters which are needed for drag and drop actions.
- Define function
onDragEnd
inHome
and add logics for listing. - Create
localStorage.ts
file inmodels
directory and define functions for saving data in local storage. - Add local storage saving logic in
Home
- Add a button in the
Board
and define onClick event for deleting board. Done.
Please dont' care about the coloring things in this stage, just define components and drag&drop actions.
- Design it with design tools or something, in my case Figma.
- Visit Google Fonts and select the fonts you want to use. Copy the
<link>
to embed. - Install react-helmet via npm,
npm install --save react-helmet
. - Add
Helmet
component aboveRouter
component and embed the link that we copied in step 2. - Install styled-compents via npm,
npm install --save styled-components
. - Create a directory called
styles
. - Remove default settings in CSS. You can do this in various ways. In my case, define
createGlobalStyle
inApp.tsx
and paste the code of this. - Make
styled.d.ts
file instyles
folder and declare module'styled-components'
and add interfaceDefaultTheme
. - Make
theme.ts
file instyles
folder and define colors in themes usingDefaultTheme
you want to use. In my case, I defineddarkTheme
andlightTheme
. - Make
global.d.ts
file insrc
folder and declare modules to use image files. - Show off your CSS skills! Make styled components in the files you need. If you have to make a identical styled
components in different files, make
styles.tsx
file instyles
folder, put them there, and import them where you need.
Please don't just copy my design or codes. That doesn't help you at all.
![]()
![]()
![]()
![]()
-
You can deploy your website in various ways. In my case, I deployed by publishing files to
gh-pages
branch on GitHub. -
Make Repository on GitHub and push all the files.
-
Install gh-pages via npm,
npm install gh-pages --save-dev
. -
Go to
package.json
and add"homepage"
right above the last curly brace. Usehttps://user-id-here.github.io/repository-name-here
-
}, "homepage": "https://codeisneverodd.github.io/practice-with-react-typescript-for-crypto-dictionary/" }
-
Add
"deploy"
and"predeploy"
toscript
inpackage.json
. -
"scripts": { "deploy": "gh-pages -d build", "predeploy": "npm run build" },
-
Finish deployment by entering
npm run deploy
in the console.
Don't forget to add
basename={process.env.PUBLIC_URL}
in your BrowserRouter