User Interface Project

(~15 minutes)

The UI Project will rely on the following:

  • React -The create-react-app is sufficient starter for this MVP project )

  • Apollo Client - Allows the UI to interact with the Apollo GraphQL data tier,

  • React Router - An easy to use router for react.

  • Ant Design - A versatile UI framework for React.

  • Tailwindcss - Adds css styling through class names

  • Storybook

Begin by initializing the project with these libraries.

From the azure-quickstart directory open a command prompt or console and issue the following commands:

Terminal / Command Propt

npx create-react-app ui --template typescript
cd ui

##CRACO IS USED FOR LESS (AntDesign Customization)
npm i @craco/craco@7.0.0-alpha.3 
npm i -D craco-less@2.1.0-alpha.0
npm i process browserify-zlib stream-browserify util buffer assert crypto-browserify

## Tailwind CSS is handy for UI design
npm install -D tailwindcss postcss autoprefixer
npx tailwindcss init -p #-p creates a postcss.config.js file

npm install @apollo/client graphql
npm install react-router-dom # ?? @types/react-router-dom
npm install antd


#npm i prop-types @types/prop-types
npx sb init --builder webpack5 # select NO if asked for npm7 migration
##npx -p @storybook/cli sb init
npm i -D @storybook/addons @storybook/theming chromatic
##npm i -D storybook-addon-playwright

In order to enable VS code debugging, the launch.json file will need to be modified.

Launch VS Code:

Create launch.json file

In VSCode, In the left panel, go to the run tab. Click create a launch.json file and select Chrome from the dropdown.

Edit the launch.json file

(update port number as per your settings)

Add a tasks.json file

(update port number as per your settings)

Add a .env file

Navigate to the source control tab of VS Code, locate the.env file and choose "Add to .gitignore"

In a multi-developer scenario developers will use .env.local, we'll only add default and non-sensitive values to the .env file

Go Ahead and launch the website by using VSCode Debugger.

Note: If the browser window does not open when you launch it from VSCode, then try removing "Browser=none" entry from .env file and relaunching app. This issue may occur when you already have a browser open from another app launch (such as Storybook)

Additional Reading:

Last updated

Was this helpful?