Author: @cstayyab
- Clone the repository
git clone https://github.com/cstayyab/react-playground
- Install dependencies
npm install
- Run the project
npm start
- Open in browser and navigate to any component via tab bar at the top
Here's the list of components that are available in this project with thier respective documentation.
Creates a File Drag and Drop component and stores it in IndexedDB as downloadable file
// src/App.js
import React from 'react';
import styles from './App.css';
import FileUpload from './components/FileUpload';
function App() {
return (
<div style={{
display: 'flex',
flexDirection: 'column',
alignItems: 'center',
justifyContent: 'center',
height: '100vh'
}}>
<FileUpload />
</div>
);
}
export default App;
Generates a QR Code for the given text and display it as a Card with its title and description. This component was created as a solution to problem given on Frontend Mentor.
// src/App.js
import React from 'react';
import QrCode from './components/QrCode';
function App() {
return (
<div style={{
display: 'flex',
flexDirection: 'column',
alignItems: 'center',
justifyContent: 'center',
height: '100vh'
}}>
<QrCode value="https://www.frontendmentor.io/" title="Improve your front-end skills by building projects" description="Scan your QR code to visit Frontend Mentor and take your coding skills to the next level"/>
</div>
);
}
export default App;
Tabs are used to navigate between different components so you can preview all the available components easily. They are defined in src/components/ReactTabs.js
and can be used as follows:
// src/App.js
import React from 'react';
import FileUpload from './components/FileUpload';
import QrCode from './components/QrCode';
import Tabs from './components/ReactTabs';
function App() {
return (
<Tabs tabs={[
{
title: 'File Upload',
component: <FileUpload />
},
{
title: 'QR Code',
component: <QrCode value="https://www.frontendmentor.io/" title="Improve your front-end skills by building projects" description="Scan your QR code to visit Frontend Mentor and take your coding skills to the next level" />
}
]} active={0}/>
);
}
export default App;