# REACTJS — SESSION MONKCHAT | LINGUAGEM DE PROGRAMAÇÃO AUTHOR: IGOR LIMA CHARLES GRADE: INFORMÁTICA A N°: 18 ### ESTRUTURAMENTO DE PASTAS > ![](https://i.imgur.com/3jBmd5b.png) ### REACT RODANDO > ![](https://i.imgur.com/nWK4rqz.png) # PUBLIC > INDEX.HTML ```jsx= <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8" /> <link rel="icon" href="%PUBLIC_URL%/favicon.ico" /> <meta name="viewport" content="width=device-width, initial-scale=1" /> <meta name="theme-color" content="#000000" /> <meta name="description" content="Web site created using create-react-app" /> <link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" /> <!-- manifest.json provides metadata used when your web app is installed on a user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/ --> <link rel="manifest" href="%PUBLIC_URL%/manifest.json" /> <!-- Notice the use of %PUBLIC_URL% in the tags above. It will be replaced with the URL of the `public` folder during the build. Only files inside the `public` folder can be referenced from the HTML. Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will work correctly both with client-side routing and a non-root public URL. Learn how to configure a non-root public URL by running `npm run build`. --> <style> @import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@700&display=swap'); @import url('https://fonts.googleapis.com/css2?family=Montserrat&display=swap'); </style> <title>React App</title> </head> <body> <noscript>You need to enable JavaScript to run this app.</noscript> <div id="root"></div> <!-- This HTML file is a template. If you open it directly in the browser, you will see an empty page. You can add webfonts, meta tags, or analytics to this file. The build step will place the bundled scripts into the <body> tag. To begin the development, run `npm start` or `yarn start`. To create a production bundle, use `npm run build` or `yarn build`. --> </body> </html> ``` # SRC > COMPONENTS > CABECALHO ## INDEX.JS ```jsx= import { Barra, ContainerCabecalho } from "./styled" export default function Cabecalho () { return ( <ContainerCabecalho> <div class="logo"> <img src="/assets/images/logo-monkchat.png" alt=""/> </div> <Barra/> <div class="titulo"> MonkChat </div> </ContainerCabecalho> ) } ``` ## STYLED.JS ```jsx= import styled from "styled-components"; const Barra = styled.div` background: linear-gradient(180deg, #BA9D4C -10.17%, #F3D991 115.25%); width: 4px; height: 3em; margin: 0em 1em; border-radius: 1em; ` const ContainerCabecalho = styled.div` display: flex; flex-direction: row; align-items: center; margin-bottom: 3em; .titulo { font: 700 2.2em Montserrat; } ` export {Barra, ContainerCabecalho} ``` # SRC > COMPONENTS > INPUTS [INPUT.JS] ```jsx= import styled from 'styled-components' const ChatButton = styled.button` font-weight: 700; color: #fff; background: #50B4BF; border: none; border-radius: 20px; padding: .5em 1.65em; margin: .3em; cursor: pointer; &:hover { background-color: #299ca8; } ` const ChatInput = styled.input` border: none; background: #FFFFFF; border-radius: 5px; outline: none; padding: .4em .5em; cursor: text; ` const ChatTextArea = styled.textarea` border: none; background: #FFFFFF; border-radius: 5px; outline: none; padding: .4em .5em; cursor: text; height: 12em; margin: .5em 0em; ` export { ChatButton, ChatInput, ChatTextArea } ``` # SRC > PAGES > MONKCHAT ## CONTEUDO.JS ```jsx= import { ContainerConteudo } from './conteudo.styled' import { ChatButton, ChatInput, ChatTextArea } from '../../components/inputs/inputs' export default function Conteudo() { return ( <ContainerConteudo> <div className="container-form"> <div className="box-sala"> <div> <div className="label">Sala</div> <ChatInput /> </div> <div> <div className="label">Nick</div> <ChatInput /> </div> <div> <ChatButton> Criar </ChatButton> <ChatButton> Entrar </ChatButton> </div> </div> <div className="box-mensagem"> <div className="label">Mensagem</div> <ChatTextArea /> <ChatButton className="btn-enviar"> Enviar </ChatButton> </div> </div> <div className="container-chat"> <img className="chat-atualizar" src="/assets/images/atualizar.png" alt="" /> <div className="chat"> <div className="chat-message"> <div>(12:15)</div> <div><b>Bruno</b> fala para <b>Todos</b>:</div> <div> Fala aee povo! </div> </div> <div className="chat-message"> <div>(12:15)</div> <div><b>Igor</b> fala para <b>Bruno</b>:</div> <div> Oiee! </div> </div> <div className="chat-message"> <div>(12:15)</div> <div><b>Bruno</b> fala para <b>Todos</b>:</div> <div> Fala aee povo! </div> </div> <div className="chat-message"> <div>(12:15)</div> <div><b>Bruno</b> fala para <b>Todos</b>:</div> <div> Fala aee povo! </div> </div> <div className="chat-message"> <div>(12:15)</div> <div><b>Bruno</b> fala para <b>Todos</b>:</div> <div> Fala aee povo! </div> </div> <div className="chat-message"> <div>(12:15)</div> <div><b>Bruno</b> fala para <b>Todos</b>:</div> <div> Fala aee povo! </div> </div> <div className="chat-message"> <div>(12:15)</div> <div><b>Bruno</b> fala para <b>Todos</b>:</div> <div> Fala aee povo! </div> </div> <div className="chat-message"> <div>(12:15)</div> <div><b>Bruno</b> fala para <b>Todos</b>:</div> <div> Fala aee povo! </div> </div> <div className="chat-message"> <div>(12:15)</div> <div><b>Bruno</b> fala para <b>Todos</b>:</div> <div> Fala aee povo! </div> </div> <div className="chat-message"> <div>(12:15)</div> <div><b>Bruno</b> fala para <b>Todos</b>:</div> <div> Fala aee povo! </div> </div> <div className="chat-message"> <div>(12:15)</div> <div><b>Bruno</b> fala para <b>Todos</b>:</div> <div> Fala aee povo! </div> </div> <div className="chat-message"> <div>(12:15)</div> <div><b>Bruno</b> fala para <b>Todos</b>:</div> <div> Fala aee povo! </div> </div> <div className="chat-message"> <div>(12:15)</div> <div><b>Bruno</b> fala para <b>Todos</b>:</div> <div> Fala aee povo! </div> </div> <div className="chat-message"> <div>(12:15)</div> <div><b>Bruno</b> fala para <b>Todos</b>:</div> <div> Fala aee povo! </div> </div> <div className="chat-message"> <div>(12:15)</div> <div><b>Bruno</b> fala para <b>Todos</b>:</div> <div> Fala aee povo! </div> </div> <div className="chat-message"> <div>(12:16)</div> <div><b>Igor</b> fala para <b>Todos</b>:</div> <div> Vixe! Travou, glr! </div> </div> </div> </div> </ContainerConteudo> ) } ``` ## CONTEUDO-STYLED.JS ```jsx= import styled from 'styled-components' const ContainerConteudo = styled.div` display: flex; flex-direction: row; background: rgba(0, 0, 0, 0.12); padding: 3em 5em; .container-form { display: flex; flex-direction: column; justify-content: space-between; padding: 2em; } .box-sala { display: flex; flex-direction: column; } .box-sala > div { display: flex; flex-direction: row; justify-content: flex-end; align-items: center; margin: .2em; } .label { font-weight: 700; font-size: 1.2em; width: 4em; } .box-mensagem { display: flex; flex-direction: column; } .btn-enviar { align-self: flex-end; } .container-chat { display: flex; flex-direction: column; flex-grow: 1; padding: 0em 2em 2em 2em; height: 28em; } .chat-atualizar { width: 1em; align-self: flex-end; margin: .4em; cursor: pointer; } .chat-atualizar:hover { transform: rotate(360deg); transition: 0.5s; } .chat { display: flex; flex-direction: column; background: rgba(192, 65, 224, 0.19); border-radius: 3px; padding: 1.5em; height: 100%; overflow-y: auto; } .chat::-webkit-scrollbar-track { -webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.3); border-radius: 10px; background-color: #3E006F; } .chat::-webkit-scrollbar { width: 7px; background-color: #3E006F; border-radius: 10px; } .chat::-webkit-scrollbar-thumb { border-radius: 10px; -webkit-box-shadow: inset 0 0 6px rgba(0,0,0,.3); background-color: #CBCBCB; } .chat-message { display: flex; flex-direction: row; font-size: .9em; margin: .4em .2em; } .chat-message > div { margin: 0em .2em; } @media (max-width: 400px) { flex-direction: column; padding: .2em; .container-form { padding: 1em; justify-content: flex-start; } .container-form > div { margin-bottom: 2em; } .box-sala > div { justify-content: flex-start; } .box-sala > div:nth-of-type(3) { flex-direction: column; } .chat { overflow-y: unset; height: auto; } .container-chat { height: auto; padding: 1em; } .chat-message { flex-direction: column; margin: 1em 0em } input { width: 100%; } button { width: 100%; border-radius: .3em; height: 2.5em; margin: .3em 0em; } .label { width: 4em; } } ` export { ContainerConteudo } ``` ## INDEX.JS ```jsx= import { Container } from './styled' import Cabecalho from '../../components/cabecalho' import Conteudo from './conteudo' export default function Monkchat() { return ( <Container> <Cabecalho /> <Conteudo /> </Container> ) } ``` ## STYLED.JS ```jsx= import styled from 'styled-components' const Container = styled.div` display: flex; flex-direction: column; background-color: #583BBF; color: #fff; padding: 2em 5em 6em 5em; font-family: Montserrat; min-height: 100vh; min-width: 1200px; @media (max-width: 400px) { min-width: auto; padding: 1em; font-size: .9em; } ` export { Container } ``` ## SRC > INDEX.CSS ```jsx= body { margin: 0; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; } code { font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New', monospace; } * { box-sizing: border-box; } ``` ## SRC > INDEX.JS ```jsx= import React from 'react'; import ReactDOM from 'react-dom'; import './index.css'; import Routes from './routes'; ReactDOM.render( <React.StrictMode> <Routes/> </React.StrictMode>, document.getElementById('root') ); ``` ## SRC > ROUTES.JS ```jsx= import {BrowserRouter, Switch, Route} from 'react-router-dom'; import Monkchat from './pages/monkchat/' export default function Routes () { return ( <BrowserRouter> <Switch> <Route path="/" exact={true} component={Monkchat}/> </Switch> </BrowserRouter> ) } ```
{"metaMigratedAt":"2023-06-16T08:55:37.221Z","metaMigratedFrom":"Content","title":"REACTJS — SESSION MONKCHAT | LINGUAGEM DE PROGRAMAÇÃO","breaks":true,"contributors":"[{\"id\":\"80bf1c37-2722-44c2-96a3-490c9bac8b2e\",\"add\":14003,\"del\":137}]"}
Expand menu