├── README.md ├── flex-app ├── .gitignore ├── package-lock.json ├── package.json ├── postcss.config.js ├── public │ ├── favicon.ico │ ├── index.html │ ├── logo192.png │ ├── logo512.png │ ├── manifest.json │ └── robots.txt ├── src │ ├── App.jsx │ ├── components │ │ ├── Card.jsx │ │ ├── Footer.jsx │ │ ├── header │ │ │ ├── Logo.jsx │ │ │ └── index.jsx │ │ └── menu-mobile │ │ │ └── index.jsx │ ├── index.js │ ├── pages │ │ ├── about │ │ │ ├── Banner.jsx │ │ │ ├── Text.jsx │ │ │ ├── Title.jsx │ │ │ └── index.jsx │ │ └── main │ │ │ ├── Title.jsx │ │ │ ├── display │ │ │ ├── background.svg │ │ │ └── index.jsx │ │ │ ├── form │ │ │ ├── Quantity.jsx │ │ │ ├── Select.jsx │ │ │ └── index.jsx │ │ │ └── index.jsx │ ├── routes.jsx │ └── styles │ │ ├── index.css │ │ └── tailwind.css └── tailwind.config.js └── fxapp.gif /README.md: -------------------------------------------------------------------------------- 1 | #

:straight_ruler:   Flexbox Simulator 1.0   :triangular_ruler:

2 | 3 |

4 | Aplicação desenvolvida utilizando React e Tailwind CSS, e tem como objetivo simular as principais funcionalidades do Flexbox. Por estar na 5 | Versão 1.0, o Flexbox Simulator entrega a base desse poderoso modelo de layout da Web CSS3. A escolha de um framework CSS (Tailwind CSS) para 6 | desenvolvimento da interface da aplicação, se deu pelo desejo de me aprimorar os meus conhecimento no mesmo. 7 |



8 | 9 |
10 | 11 |
12 | 13 | ## Tecnologias utilizadas: :computer: 14 | 15 | 20 | 21 | ## Instalação: :rocket: 22 | 23 | Realize o download ou clone do repositório na sua máquina. Na pasta raíz, rode o comando `yarn` ou `npm install` para instalar as dependências do projeto. 24 | 25 | Após, rode o comando `yarn start` ou `npm start` para ver a aplicação em execução em `http://localhost:3000`.

26 | 27 | #### Critícas e/ou sugestões são sempre bem-vindas =). 28 | 29 |
30 | 31 | Aplicação desenvolvida com horas a frente do :computer: por Christopher H. Schott 32 | -------------------------------------------------------------------------------- /flex-app/.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | /.pnp 6 | .pnp.js 7 | 8 | # testing 9 | /coverage 10 | 11 | # production 12 | /build 13 | 14 | # misc 15 | .DS_Store 16 | .env.local 17 | .env.development.local 18 | .env.test.local 19 | .env.production.local 20 | 21 | npm-debug.log* 22 | yarn-debug.log* 23 | yarn-error.log* 24 | -------------------------------------------------------------------------------- /flex-app/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "flex-app", 3 | "version": "0.1.0", 4 | "private": true, 5 | "dependencies": { 6 | "@testing-library/jest-dom": "^4.2.4", 7 | "@testing-library/react": "^9.3.2", 8 | "@testing-library/user-event": "^7.1.2", 9 | "autoprefixer": "^9.8.4", 10 | "font-awesome": "^4.7.0", 11 | "postcss-cli": "^7.1.1", 12 | "postcss-import": "^12.0.1", 13 | "react": "^16.13.1", 14 | "react-dom": "^16.13.1", 15 | "react-router": "^5.2.0", 16 | "react-router-dom": "^5.2.0", 17 | "react-scripts": "3.4.1", 18 | "tailwindcss": "^1.4.6" 19 | }, 20 | "scripts": { 21 | "build:style": "tailwind build src/styles/index.css -o src/styles/tailwind.css", 22 | "start": "npm run build:style && react-scripts start", 23 | "build": "react-scripts build", 24 | "test": "react-scripts test", 25 | "eject": "react-scripts eject" 26 | }, 27 | "eslintConfig": { 28 | "extends": "react-app" 29 | }, 30 | "browserslist": { 31 | "production": [ 32 | ">0.2%", 33 | "not dead", 34 | "not op_mini all" 35 | ], 36 | "development": [ 37 | "last 1 chrome version", 38 | "last 1 firefox version", 39 | "last 1 safari version" 40 | ] 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /flex-app/postcss.config.js: -------------------------------------------------------------------------------- 1 | const tailwindcss = require('tailwindcss'); 2 | module.exports = { 3 | plugins: [ 4 | tailwindcss('./tailwind.js'), 5 | require('autoprefixer'), 6 | ], 7 | }; -------------------------------------------------------------------------------- /flex-app/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChristopherHauschild/flexbox-app-react/6cba0d0f08c64ae835d941914d5a8c3048bd8043/flex-app/public/favicon.ico -------------------------------------------------------------------------------- /flex-app/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 12 | 13 | 14 | 15 | 16 | FlexApp - React 17 | 18 | 19 | 20 |
21 | 22 | 23 | -------------------------------------------------------------------------------- /flex-app/public/logo192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChristopherHauschild/flexbox-app-react/6cba0d0f08c64ae835d941914d5a8c3048bd8043/flex-app/public/logo192.png -------------------------------------------------------------------------------- /flex-app/public/logo512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChristopherHauschild/flexbox-app-react/6cba0d0f08c64ae835d941914d5a8c3048bd8043/flex-app/public/logo512.png -------------------------------------------------------------------------------- /flex-app/public/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "short_name": "React App", 3 | "name": "Create React App Sample", 4 | "icons": [ 5 | { 6 | "src": "favicon.ico", 7 | "sizes": "64x64 32x32 24x24 16x16", 8 | "type": "image/x-icon" 9 | }, 10 | { 11 | "src": "logo192.png", 12 | "type": "image/png", 13 | "sizes": "192x192" 14 | }, 15 | { 16 | "src": "logo512.png", 17 | "type": "image/png", 18 | "sizes": "512x512" 19 | } 20 | ], 21 | "start_url": ".", 22 | "display": "standalone", 23 | "theme_color": "#000000", 24 | "background_color": "#ffffff" 25 | } 26 | -------------------------------------------------------------------------------- /flex-app/public/robots.txt: -------------------------------------------------------------------------------- 1 | # https://www.robotstxt.org/robotstxt.html 2 | User-agent: * 3 | Disallow: 4 | -------------------------------------------------------------------------------- /flex-app/src/App.jsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | 3 | import Header from './components/header'; 4 | import Routes from './routes'; 5 | import Footer from './components/Footer'; 6 | 7 | function App() { 8 | return ( 9 |
10 |
11 |
12 | 13 |
14 |
16 | ); 17 | } 18 | 19 | export default App; 20 | -------------------------------------------------------------------------------- /flex-app/src/components/Card.jsx: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | 3 | const Card = ({ children }) => { 4 | return ( 5 |
6 | {children} 7 |
8 | ) 9 | } 10 | 11 | export default Card -------------------------------------------------------------------------------- /flex-app/src/components/Footer.jsx: -------------------------------------------------------------------------------- 1 | import React from "react" 2 | 3 | const Footer = () => { 4 | return ( 5 | 14 | ) 15 | } 16 | 17 | export default Footer 18 | 19 | const styles = { 20 | icon: { 21 | color: 'red', 22 | margin: '0px 8px' 23 | } 24 | } -------------------------------------------------------------------------------- /flex-app/src/components/header/Logo.jsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | 3 | const Logo = () => { 4 | return ( 5 |
6 | 7 | 8 | Flexbox Simulator 9 | 10 |
11 | ) 12 | } 13 | 14 | export default Logo -------------------------------------------------------------------------------- /flex-app/src/components/header/index.jsx: -------------------------------------------------------------------------------- 1 | import React, { useState } from "react"; 2 | import Logo from "./Logo"; 3 | 4 | import MenuMobile from "../menu-mobile"; 5 | 6 | const Header = () => { 7 | const [isMenuOpen, setIsMenuOpen] = useState(false) 8 | 9 | const handleOpenMenu = () => { 10 | if(!isMenuOpen) { 11 | setIsMenuOpen(true) 12 | return 13 | } 14 | setIsMenuOpen(false) 15 | return 16 | } 17 | 18 | return ( 19 | 55 | ); 56 | }; 57 | 58 | export default Header; 59 | -------------------------------------------------------------------------------- /flex-app/src/components/menu-mobile/index.jsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | 3 | const MenuMobile = () => { 4 | return ( 5 |
6 |
7 | 8 | Sobre 9 | 10 |
11 |
12 | 18 | Código 19 | 20 |
21 |
22 | ); 23 | }; 24 | 25 | export default MenuMobile; 26 | -------------------------------------------------------------------------------- /flex-app/src/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import ReactDOM from 'react-dom'; 3 | 4 | import './styles/tailwind.css'; 5 | import 'font-awesome/css/font-awesome.min.css'; 6 | 7 | import App from './App'; 8 | 9 | ReactDOM.render( 10 | 11 | 12 | , 13 | document.getElementById('root') 14 | ); 15 | -------------------------------------------------------------------------------- /flex-app/src/pages/about/Banner.jsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | 3 | const Banner = () => { 4 | return ( 5 |
9 |
10 | 11 | 12 | Flexbox Simulator 13 | 14 |
15 |
16 | ); 17 | }; 18 | 19 | export default Banner; 20 | -------------------------------------------------------------------------------- /flex-app/src/pages/about/Text.jsx: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | 3 | const Text = ({ children }) => { 4 | return ( 5 |
6 |

7 | {children} 8 |

9 |
10 | ) 11 | } 12 | 13 | export default Text -------------------------------------------------------------------------------- /flex-app/src/pages/about/Title.jsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | 3 | const Title = () => { 4 | return ( 5 |
6 |
7 | Sobre a aplicação 8 |
9 |
10 | ); 11 | }; 12 | 13 | export default Title; 14 | -------------------------------------------------------------------------------- /flex-app/src/pages/about/index.jsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | 3 | import Card from "../../components/Card"; 4 | 5 | import Title from "./Title"; 6 | import Banner from "./Banner"; 7 | import Text from './Text' 8 | 9 | const About = () => { 10 | return ( 11 | 12 | 13 | 14 | <Banner /> 15 | 16 | <Text> 17 | A presente aplicação foi desenvolvida utilizando React e Tailwind CSS, e 18 | visa simular as principais funcionalidades do Flexbox. Por estar na 19 | Versão 1.0, o Flexbox Simulator entrega a base desse poderoso modelo de 20 | layout da Web CSS3. A escolha de um framework CSS (Tailwind CSS) para 21 | desenvolvimento da interface da aplicação, se deu pelo desejo de me 22 | aprimorar os meus conhecimento no mesmo.<br /> <br /> 23 | Críticas e sugestões são sempre bem-vindas =) 24 | </Text> 25 | </Card> 26 | ); 27 | }; 28 | 29 | export default About; 30 | -------------------------------------------------------------------------------- /flex-app/src/pages/main/Title.jsx: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | 3 | const Title = () => { 4 | return ( 5 | <div className='flex self-start border-b w-full py-2'> 6 | <div className='text-lg sm:text-lg md:text-xl md:ml-4 items-end flex flex-wrap'> 7 | <span className='mr-2'>Simule os super-poderes do Flexbox</span> 8 | <small className='text-gray-500'>Versão 1.0</small> 9 | </div> 10 | </div> 11 | ) 12 | } 13 | 14 | export default Title -------------------------------------------------------------------------------- /flex-app/src/pages/main/display/background.svg: -------------------------------------------------------------------------------- 1 | <svg xmlns='http://www.w3.org/2000/svg' width='400' height='200' viewBox='0 0 160 80'><rect fill='#ffffff' width='160' height='80'/><g fill='#f3f3f3' fill-opacity='0.8'><polygon points='0 10 0 0 10 0'/><polygon points='0 40 0 30 10 30'/><polygon points='0 30 0 20 10 20'/><polygon points='0 70 0 60 10 60'/><polygon points='0 80 0 70 10 70'/><polygon points='50 80 50 70 60 70'/><polygon points='10 20 10 10 20 10'/><polygon points='10 40 10 30 20 30'/><polygon points='20 10 20 0 30 0'/><polygon points='10 10 10 0 20 0'/><polygon points='30 20 30 10 40 10'/><polygon points='20 20 20 40 40 20'/><polygon points='40 10 40 0 50 0'/><polygon points='40 20 40 10 50 10'/><polygon points='40 40 40 30 50 30'/><polygon points='30 40 30 30 40 30'/><polygon points='40 60 40 50 50 50'/><polygon points='50 30 50 20 60 20'/><polygon points='40 60 40 80 60 60'/><polygon points='50 40 50 60 70 40'/><polygon points='60 0 60 20 80 0'/><polygon points='70 30 70 20 80 20'/><polygon points='70 40 70 30 80 30'/><polygon points='60 60 60 80 80 60'/><polygon points='80 10 80 0 90 0'/><polygon points='70 40 70 60 90 40'/><polygon points='80 60 80 50 90 50'/><polygon points='60 30 60 20 70 20'/><polygon points='80 70 80 80 90 80 100 70'/><polygon points='80 10 80 40 110 10'/><polygon points='110 40 110 30 120 30'/><polygon points='90 40 90 70 120 40'/><polygon points='10 50 10 80 40 50'/><polygon points='110 60 110 50 120 50'/><polygon points='100 60 100 80 120 60'/><polygon points='110 0 110 20 130 0'/><polygon points='120 30 120 20 130 20'/><polygon points='130 10 130 0 140 0'/><polygon points='130 30 130 20 140 20'/><polygon points='120 40 120 30 130 30'/><polygon points='130 50 130 40 140 40'/><polygon points='120 50 120 70 140 50'/><polygon points='110 70 110 80 130 80 140 70'/><polygon points='140 10 140 0 150 0'/><polygon points='140 20 140 10 150 10'/><polygon points='140 40 140 30 150 30'/><polygon points='140 50 140 40 150 40'/><polygon points='140 70 140 60 150 60'/><polygon points='150 20 150 40 160 30 160 20'/><polygon points='150 60 150 50 160 50'/><polygon points='140 70 140 80 150 80 160 70'/></g></svg> -------------------------------------------------------------------------------- /flex-app/src/pages/main/display/index.jsx: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | 3 | import background from './background.svg' 4 | 5 | const Display = props => { 6 | const { quantity, display, flexDirection, flexWrap, justifyContent, 7 | alignContent, alignItems, alignSelf, selectedBlock } = props 8 | 9 | let alContent = '' 10 | 11 | if(alignItems !== 'none' || alignSelf !== 'none' ) { 12 | alContent = '' 13 | } else { 14 | alContent = alignContent 15 | } 16 | 17 | let blocks = [] 18 | let alSelf = '' 19 | let bg = '' 20 | 21 | for (let i=0; i<quantity; i++){ 22 | if(i + 1 === selectedBlock) { 23 | alSelf = `${alignSelf}` 24 | bg = 'bg-teal-600' 25 | } 26 | if(i + 1 !== selectedBlock) { 27 | bg = 'bg-teal-400' 28 | alSelf = '' 29 | } 30 | 31 | blocks.push(<div key={i} className={`flex ${bg} m-2 w-auto px-10 border-b border-r-2 border-gray-600 rounded shadow-lg justify-center items-center`} 32 | style={{ minWidth: '96px', minHeight: '96px', alignSelf: `${alSelf}` }}> 33 | <span className='text-lg font-semibold text-gray-100'>{i + 1}</span> 34 | </div>) 35 | } 36 | 37 | return ( 38 | <div className='p-4 py-4 mt-6 mb-4 sm:mb-0 w-full h-full border rounded-sm border-gray-300 shadow-lg' 39 | style={{ backgroundImage: `url(${background})`, minHeight: '218px' }} 40 | > 41 | <div className='flex h-full' style={{ display: `${display}`, flexDirection: `${flexDirection}`, 42 | flexWrap: `${flexWrap}`, justifyContent: `${justifyContent}`, 43 | alignContent: `${alContent}`, alignItems: `${alignItems}`}}> 44 | {blocks} 45 | </div> 46 | </div> 47 | ) 48 | } 49 | 50 | export default Display -------------------------------------------------------------------------------- /flex-app/src/pages/main/form/Quantity.jsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | 3 | const Quantity = (props) => { 4 | const { cols, label, id, onChangeQuality, quantity } = props; 5 | 6 | const handleQuantity = (event) => { 7 | onChangeQuality(+event.target.value) 8 | } 9 | 10 | return ( 11 | <div className={`lg:col-span-${cols} flex flex-col`}> 12 | <label 13 | className="block self-end font-semibold text-teal-600 sm:text-lg mb-2" 14 | htmlFor={id} 15 | > 16 | {label} 17 | </label> 18 | <input 19 | type='number' 20 | onChange={handleQuantity} 21 | className="shadow appearance-none border rounded w-3/4 self-end py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline" 22 | id={id} value={quantity} min={0} /> 23 | </div> 24 | ); 25 | }; 26 | 27 | export default Quantity; 28 | -------------------------------------------------------------------------------- /flex-app/src/pages/main/form/Select.jsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | 3 | const Select = (props) => { 4 | const { 5 | cols, 6 | label, 7 | id, 8 | selectedBlock, 9 | quantity, 10 | options, 11 | onChangeDisplay, 12 | onChangeFlexDirection, 13 | onChangeFlexWrap, 14 | onChangeJustifyContent, 15 | onChangeAlignContent, 16 | onChangeAlignItems, 17 | onChangeAlignSelf, 18 | onChangeSelectedBlock 19 | } = props; 20 | 21 | const onSelectHandle = (event) => { 22 | const optionSelected = event.target.value; 23 | if (event.target.id === "display") { 24 | onChangeDisplay(optionSelected.toLowerCase()); 25 | } 26 | if (event.target.id === "direction") { 27 | onChangeFlexDirection(optionSelected.toLowerCase()); 28 | } 29 | if (event.target.id === "wrap") { 30 | onChangeFlexWrap(optionSelected.toLowerCase()); 31 | } 32 | if (event.target.id === "justify-content") { 33 | onChangeJustifyContent(optionSelected.toLowerCase()); 34 | } 35 | if (event.target.id === "align-content") { 36 | onChangeAlignContent(optionSelected.toLowerCase()); 37 | } 38 | if (event.target.id === "align-items") { 39 | onChangeAlignItems(optionSelected.toLowerCase()); 40 | } 41 | if (event.target.id === "align-self") { 42 | onChangeAlignSelf(optionSelected.toLowerCase()); 43 | } 44 | }; 45 | 46 | const handleSelectedBlock = (event) => { 47 | onChangeSelectedBlock(+event.target.value) 48 | } 49 | 50 | const setBlock = id === "align-self"; 51 | const width = setBlock ? "w-3/5" : "w-full"; 52 | 53 | return ( 54 | <div className={`box-content lg:col-span-${cols}`}> 55 | <label className="flex items-center block text-gray-600 sm:text-lg mb-2" htmlFor={id}> 56 | <span className='flex-1'>{label}</span> {setBlock && <small className='mr-4'>Bloco (min 0 - max {quantity})</small>} 57 | </label> 58 | <select 59 | onChange={onSelectHandle} 60 | className={`shadow appearance-none border rounded ${width} py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline`} 61 | id={id} 62 | > 63 | {options.map((option, index) => { 64 | return ( 65 | <option key={index} value={option}> 66 | {option} 67 | </option> 68 | ); 69 | })} 70 | </select> 71 | 72 | {setBlock && ( 73 | <input 74 | type='number' 75 | min={0} 76 | max={quantity} 77 | value={selectedBlock} 78 | onChange={handleSelectedBlock} 79 | className={`shadow appearance-none border rounded w-4/12 ml-2 py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline`} 80 | id={id} 81 | /> 82 | )} 83 | </div> 84 | ); 85 | }; 86 | 87 | export default Select; 88 | -------------------------------------------------------------------------------- /flex-app/src/pages/main/form/index.jsx: -------------------------------------------------------------------------------- 1 | import React, { useState } from "react"; 2 | 3 | import Select from "./Select"; 4 | import Quantity from './Quantity' 5 | import Display from "../display"; 6 | 7 | const Form = () => { 8 | const[quantity, setQuantity] = useState(1) 9 | const[selectedBlock, setSelectedBlock] = useState(1) 10 | const[display, setDisplay] = useState('flex') 11 | const[flexDirection, setFlexDirection] = useState('row') 12 | const[flexWrap, setFlexWrap] = useState('wrap') 13 | const[justifyContent, setJustifyContent] = useState('flex-start') 14 | const[alignContent, setAlignContent] = useState('flex-start') 15 | const[alignItems, setAlignItems] = useState('none') 16 | const[alignSelf, setAlignSelf] = useState('none') 17 | 18 | const handleQuantity = (newValue) => { 19 | setQuantity(newValue) 20 | } 21 | 22 | const handleDisplay = (newValue) => { 23 | setDisplay(newValue) 24 | } 25 | 26 | const handleFlexDirection = (newValue) => { 27 | setFlexDirection(newValue) 28 | } 29 | 30 | const handleFlexWrap = (newValue) => { 31 | setFlexWrap(newValue) 32 | } 33 | 34 | const handleJustifyContent = (newValue) => { 35 | setJustifyContent(newValue) 36 | } 37 | 38 | const handleAlignContent = (newValue) => { 39 | setAlignContent(newValue) 40 | } 41 | 42 | const handleAlignItems = (newValue) => { 43 | setAlignItems(newValue) 44 | } 45 | 46 | const handleAlignSelf = (newValue) => { 47 | setAlignSelf(newValue) 48 | } 49 | 50 | const handleSelectedBlock = (newValue) => { 51 | setSelectedBlock(newValue) 52 | } 53 | 54 | return ( 55 | <div className='flex flex-col w-full h-auto mt-5 mb-2 justify-between'> 56 | <form className="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 row-gap-4 col-gap-6 h-auto w-full p-4 pb-8 bg-gray-200 rounded-sm shadow-md"> 57 | <Select 58 | id="display" 59 | label="Display" 60 | onChangeDisplay={handleDisplay} 61 | cols={1} 62 | options={["Flex", "Block", "Inline-block", "Inline", "None"]} 63 | /> 64 | <Select 65 | id="direction" 66 | onChangeFlexDirection={handleFlexDirection} 67 | label="Flex-direction" 68 | options={["Row", "Row-reverse", "Column", "Column-reverse", "Initial"]} 69 | /> 70 | <Select 71 | id="wrap" 72 | label="Flex-wrap" 73 | onChangeFlexWrap={handleFlexWrap} 74 | cols={1} 75 | options={["Wrap", "Nowrap", "Wrap-reverse", "Initial"]} 76 | /> 77 | <Select 78 | id="justify-content" 79 | cols={1} 80 | onChangeJustifyContent={handleJustifyContent} 81 | label="Justify-content" 82 | options={["Flex-start", "Flex-end", "Center", "Space-between", "Space-around"]} 83 | /> 84 | <Select 85 | id="align-content" 86 | label="Align-content" 87 | cols={1} 88 | onChangeAlignContent={handleAlignContent} 89 | options={["Flex-start", "Flex-end", "Center", "Space-between", "Space-around", "Stretch"]} 90 | /> 91 | <Select 92 | id="align-items" 93 | label="Align-items" 94 | cols={1} 95 | onChangeAlignItems={handleAlignItems} 96 | options={["None", "Baseline", "Center", "Flex-start", "Flex-end", "Initial", "Inherit", "Stretch"]} 97 | /> 98 | <Select 99 | id="align-self" 100 | label="Align-self" 101 | quantity={quantity} 102 | onChangeAlignSelf={handleAlignSelf} 103 | onChangeSelectedBlock={handleSelectedBlock} 104 | selectedBlock={selectedBlock} 105 | cols={1} 106 | options={["None", "Auto", "Center", "Flex-start", "Flex-end", "Baseline", "Initial", "Stretch"]} 107 | /> 108 | 109 | <Quantity 110 | id="quantity" 111 | quantity={quantity} 112 | label="Quantidade de Blocos" 113 | cols={1} 114 | onChangeQuality={handleQuantity} 115 | /> 116 | 117 | </form> 118 | 119 | <Display 120 | display={display} 121 | flexDirection={flexDirection} 122 | flexWrap={flexWrap} 123 | justifyContent={justifyContent} 124 | alignContent={alignContent} 125 | alignItems={alignItems} 126 | alignSelf={alignSelf} 127 | 128 | selectedBlock={selectedBlock} 129 | quantity={quantity} 130 | /> 131 | </div> 132 | ); 133 | }; 134 | 135 | export default Form; 136 | -------------------------------------------------------------------------------- /flex-app/src/pages/main/index.jsx: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | 3 | import Card from '../../components/Card' 4 | 5 | import Title from './Title' 6 | import Form from './form' 7 | 8 | const Main = () => { 9 | return ( 10 | <Card> 11 | <Title /> 12 | <Form /> 13 | </Card> 14 | ) 15 | } 16 | 17 | export default Main -------------------------------------------------------------------------------- /flex-app/src/routes.jsx: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | import { Route, BrowserRouter, Switch, Redirect } from 'react-router-dom' 3 | 4 | import Main from './pages/main/index' 5 | import About from './pages/about/index' 6 | 7 | const Routes = () => { 8 | return ( 9 | <BrowserRouter> 10 | <Switch> 11 | <Route path='/' exact component={Main} /> 12 | <Route path='/about' component={About} /> 13 | <Redirect from='*' to='/' /> 14 | </Switch> 15 | </BrowserRouter> 16 | ) 17 | } 18 | 19 | export default Routes -------------------------------------------------------------------------------- /flex-app/src/styles/index.css: -------------------------------------------------------------------------------- 1 | @import "tailwindcss/base"; 2 | 3 | @import "tailwindcss/components"; 4 | 5 | @import "tailwindcss/utilities"; 6 | -------------------------------------------------------------------------------- /flex-app/tailwind.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | purge: [], 3 | theme: { 4 | extend: {}, 5 | }, 6 | variants: {}, 7 | plugins: [], 8 | } 9 | -------------------------------------------------------------------------------- /fxapp.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChristopherHauschild/flexbox-app-react/6cba0d0f08c64ae835d941914d5a8c3048bd8043/fxapp.gif --------------------------------------------------------------------------------