diff --git a/dashboard-client/app/app/src/App.css b/dashboard-client/app/app/src/App.css deleted file mode 100644 index 92f956e804..0000000000 --- a/dashboard-client/app/app/src/App.css +++ /dev/null @@ -1,32 +0,0 @@ -.App { - text-align: center; -} - -.App-logo { - animation: App-logo-spin infinite 20s linear; - height: 40vmin; -} - -.App-header { - background-color: #282c34; - min-height: 100vh; - display: flex; - flex-direction: column; - align-items: center; - justify-content: center; - font-size: calc(10px + 2vmin); - color: white; -} - -.App-link { - color: #61dafb; -} - -@keyframes App-logo-spin { - from { - transform: rotate(0deg); - } - to { - transform: rotate(360deg); - } -} diff --git a/dashboard-client/app/app/src/App.js b/dashboard-client/app/app/src/App.js index 7e261ca47e..04ed341f2b 100644 --- a/dashboard-client/app/app/src/App.js +++ b/dashboard-client/app/app/src/App.js @@ -1,26 +1,51 @@ import React, { Component } from 'react'; -import logo from './logo.svg'; -import './App.css'; +import styled from 'styled-components'; + +import Input from './components/Input'; +import Results from './components/Results'; + +const Container = styled.div` + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + padding: 15px; + border-radius: 4px; + box-shadow: 0 0 4px 0 #777; +`; class App extends Component { + state = { + number: null, + foundPRs: [] + }; + + handleInputChange = (event) => { + const { value } = event.target; + + this.setState((prevState) => ({ number: value })); + } + + handleButtonClick = () => { + const { number } = this.state; + + fetch(`https://pr-relations.glitch.me/test/${number}`) + .then((response) => response.json()) + .then(({ foundPRs }) => { + console.log(foundPRs); + this.setState((prevState) => ({ foundPRs })) + }); + } + render() { + const { foundPRs } = this.state; + return ( -
-
- logo -

- Edit src/App.js and save to reload. -

- - Learn React - -
-
+ + + + + ); } } diff --git a/dashboard-client/app/app/src/components/Input.js b/dashboard-client/app/app/src/components/Input.js new file mode 100644 index 0000000000..029f9905f6 --- /dev/null +++ b/dashboard-client/app/app/src/components/Input.js @@ -0,0 +1,11 @@ +import React from 'react'; + +const Input = ({ onInputChange }) => ( + +); + +export default Input; diff --git a/dashboard-client/app/app/src/components/Results.js b/dashboard-client/app/app/src/components/Results.js new file mode 100644 index 0000000000..a0acc8b4a7 --- /dev/null +++ b/dashboard-client/app/app/src/components/Results.js @@ -0,0 +1,27 @@ +import React from 'react'; + +const Results = ({ foundPRs }) => { + const elements = foundPRs.map((foundPR) => { + const { number, filenames } = foundPR; + const files = filenames.map((filename, index) => { + return
  • {filename}
  • ; + }); + + return ( +
    +

    {number}

    + +
    + ); + }); + + return ( +
    + {elements} +
    + ); +}; + +export default Results; diff --git a/dashboard-client/app/app/src/index.css b/dashboard-client/app/app/src/index.css index cee5f348fb..b6ef5493c6 100644 --- a/dashboard-client/app/app/src/index.css +++ b/dashboard-client/app/app/src/index.css @@ -1,4 +1,12 @@ +* { + box-sizing: border-box; +} + body { + display: flex; + justify-content: center; + align-items: center; + height: 100vh; margin: 0; padding: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", diff --git a/dashboard-client/app/app/src/logo.svg b/dashboard-client/app/app/src/logo.svg deleted file mode 100644 index 6b60c1042f..0000000000 --- a/dashboard-client/app/app/src/logo.svg +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - -