diff --git a/react-typescript/public/seeding.png b/react-typescript/public/seeding.png new file mode 100644 index 00000000..cc8aac7e Binary files /dev/null and b/react-typescript/public/seeding.png differ diff --git a/react-typescript/src/components/App.css b/react-typescript/src/components/App.css deleted file mode 100644 index 29a62cba..00000000 --- a/react-typescript/src/components/App.css +++ /dev/null @@ -1,39 +0,0 @@ -.App { - text-align: center; - height: 50vh; -} - -.App-logo { - height: 40vmin; - pointer-events: none; -} - -@media (prefers-reduced-motion: no-preference) { - .App-logo { - animation: App-logo-spin infinite 20s linear; - } -} - -.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/react-typescript/src/components/App.tsx b/react-typescript/src/components/App.tsx index a1fe4162..bdb1c157 100644 --- a/react-typescript/src/components/App.tsx +++ b/react-typescript/src/components/App.tsx @@ -1,5 +1,6 @@ import { createGlobalStyle } from 'styled-components'; import ItemsSection from './ItemsSection'; +import Header from './Header'; function App(): JSX.Element { @@ -9,15 +10,14 @@ function App(): JSX.Element { padding: 0; } html, body { + @import url('https://fonts.googleapis.com/css2?family=Roboto:wght@100;300;500&family=Ubuntu:wght@300;400;500;700&display=swap'); + font-family: 'Roboto', sans-serif; background-color: RGB(255, 255, 253); color: RGB(227, 226, 215); width: 100%; height: 100%; } body { - font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", - "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", - sans-serif; text-align: center; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; @@ -26,7 +26,7 @@ function App(): JSX.Element { return (
- {/*
*/} +
); diff --git a/react-typescript/src/components/Button.tsx b/react-typescript/src/components/Button.tsx deleted file mode 100644 index 2ae9ebea..00000000 --- a/react-typescript/src/components/Button.tsx +++ /dev/null @@ -1,19 +0,0 @@ -import { motion } from 'framer-motion'; -import useDayLoader from '../hooks/useDayLoader'; -import styled from 'styled-components'; - -//TODO: define styled components here - -function Button() { - const Button = styled(motion.button)` - border: none; - - ` - - const { loadNextDay } = useDayLoader(); - return ( - - ); -} - -export default Button; diff --git a/react-typescript/src/components/Conjured.tsx b/react-typescript/src/components/Conjured.tsx new file mode 100644 index 00000000..b3290c6f --- /dev/null +++ b/react-typescript/src/components/Conjured.tsx @@ -0,0 +1,18 @@ +import styled from "styled-components"; +import {motion} from 'framer-motion'; + +function Conjured(value: boolean, index: number): JSX.Element { + const Conjured = styled(motion.span)` + role: 'region'; +`; + + return ( + + {value ? "✅" : "❌"} + + ); +} + +export default Conjured; \ No newline at end of file diff --git a/react-typescript/src/components/Header.tsx b/react-typescript/src/components/Header.tsx new file mode 100644 index 00000000..2ee3a8c0 --- /dev/null +++ b/react-typescript/src/components/Header.tsx @@ -0,0 +1,34 @@ +import styled from 'styled-components'; + +function Header(): JSX.Element { + const Nav = styled.nav` + display: flex; + flex-flow: column wrap; + justify-content: center; + font-size: 1rem; + align-items: center; + height: 10vh; + border-bottom: 1px solid RGB(12, 16, 36); + margin-bottom: 2rem; + span { + font-size: 1.5rem; + font-weight: 700; + font-family: 'Ubuntu', sans-serif; + color: RGB(12, 16, 36); + } + img { + height: 2.5rem; + width: 2.5rem; + } + ` + return ( + + ); +} + +export default Header; diff --git a/react-typescript/src/components/ItemsSection.tsx b/react-typescript/src/components/ItemsSection.tsx index 1dfbb2fd..a57c8292 100644 --- a/react-typescript/src/components/ItemsSection.tsx +++ b/react-typescript/src/components/ItemsSection.tsx @@ -1,24 +1,27 @@ import styled from "styled-components"; import ItemsTable from './ItemsTable'; -import Button from './Button'; import useTableController from "../hooks/useTableController"; +import TableHeader from "./TableHeader"; function ItemsSection(): JSX.Element { const ItemsSection = styled.section` - height: 100vh; display: flex; + height: 80vh; flex-flow: column wrap; - justify-content: center; + justify-content: flex-start; margin: 0 5%; + border: 1px solid RGB(12, 16, 36); + border-radius: 10px; role: 'region'; + text-align: left; `; const { columns, data } = useTableController(); return ( + - + + ); +} + +export default TableHeader; diff --git a/react-typescript/src/components/style/ButtonSectionStyle.ts b/react-typescript/src/components/style/ButtonSectionStyle.ts deleted file mode 100644 index 2a8160d6..00000000 --- a/react-typescript/src/components/style/ButtonSectionStyle.ts +++ /dev/null @@ -1,8 +0,0 @@ -import styled from 'styled-components'; - -const ButtonSectionStyle = styled.section` - width: 100%; - height: 20%; -` - -export default ButtonSectionStyle; \ No newline at end of file diff --git a/react-typescript/src/components/style/ButtonStyle.ts b/react-typescript/src/components/style/ButtonStyle.ts deleted file mode 100644 index 4672e2a4..00000000 --- a/react-typescript/src/components/style/ButtonStyle.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { css } from 'styled-components'; - -const ButtonStyle = css` - width: 1%; - height: 2%; -` - -export default ButtonStyle; \ No newline at end of file diff --git a/react-typescript/src/components/style/GlobalStyle.ts b/react-typescript/src/components/style/GlobalStyle.ts deleted file mode 100644 index 0ccea17c..00000000 --- a/react-typescript/src/components/style/GlobalStyle.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { createGlobalStyle } from "styled-components"; - -const GlobalStyle = createGlobalStyle` - * { - margin: 0; - padding: 0; - } - html, body { - background-color: RGB(132, 151, 149); - color: RGB(227, 226, 215); - width: 100%; - height: 100%; - } - body { - font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", - "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", - sans-serif; - text-align: center; - -webkit-font-smoothing: antialiased; - -moz-osx-font-smoothing: grayscale; - } -` - -export default GlobalStyle; \ No newline at end of file diff --git a/react-typescript/src/components/style/ItemsStyle.ts b/react-typescript/src/components/style/ItemsStyle.ts deleted file mode 100644 index 3f7227f1..00000000 --- a/react-typescript/src/components/style/ItemsStyle.ts +++ /dev/null @@ -1,26 +0,0 @@ -import styled from "styled-components"; - -const ItemsStyle = styled.div` - height: 85vh; - ul { - display: flex; - flex-direction: row; - flex-wrap: wrap; - width: 100%; - height: 100%; - color: white; - justify-content: center; - align-items: center; - } - li { - list-style: none; - display: inline-block; - height: 10%; - width: 40%; - border: 1px solid white; - margin: 3% 3%; - } -`; - -export default ItemsStyle; - diff --git a/react-typescript/src/components/style/index.ts b/react-typescript/src/components/style/index.ts deleted file mode 100644 index d49cca76..00000000 --- a/react-typescript/src/components/style/index.ts +++ /dev/null @@ -1,13 +0,0 @@ -import ButtonSectionStyle from './ButtonSectionStyle'; -import ButtonStyle from './ButtonStyle'; -import GlobalStyle from './GlobalStyle'; -import ItemsStyle from './ItemsStyle'; - -const styles = { - ButtonSectionStyle, - ButtonStyle, - GlobalStyle, - ItemsStyle -} - -export default styles; \ No newline at end of file diff --git a/react-typescript/src/hooks/useTableController.ts b/react-typescript/src/hooks/useTableController.ts index 50e8185c..5bb8f5aa 100644 --- a/react-typescript/src/hooks/useTableController.ts +++ b/react-typescript/src/hooks/useTableController.ts @@ -1,6 +1,9 @@ import { useMemo } from "react"; import { useStore } from "../model"; import { TTable } from "../types"; +import Conjured from "../components/Conjured"; +import Quality from "../components/Quality"; +import SellIn from "../components/SellIn"; function useTableController(): TTable { const { state } = useStore(); @@ -8,28 +11,38 @@ function useTableController(): TTable { const data = useMemo(() => items, [items]); const columns = useMemo(() => [ - { - Header: "Items", - columns: [ { Header: 'Name', accessor: 'name', + }, { Header: 'Conjured', accessor: 'isConjured', - Cell: ({ cell: { value } }: any) => { return value ? 'Yes' : 'No' }, + Cell: ({ cell: { value }, index}: any) => ( + { + ...Conjured(value, index), + } + ), }, { Header: 'Quality', - accessor: 'quality' + accessor: 'quality', + Cell: ({ cell: { value }, index}: any) => ( + { + ...Quality(value, index), + } + ), }, { - Header: 'Days Left', - accessor: 'sellIn' - } - ], - }, + Header: 'Remaining Days', + accessor: 'sellIn', + Cell: ({ cell: { value }, index}: any) => ( + { + ...SellIn(value, index), + } + ), + }, ], []); return { diff --git a/react-typescript/src/types/index.ts b/react-typescript/src/types/index.ts index aa5d9781..1e603561 100644 --- a/react-typescript/src/types/index.ts +++ b/react-typescript/src/types/index.ts @@ -4,7 +4,7 @@ type TItem = { name: string, sellIn: number, quality: number, - isConjured: boolean + isConjured: boolean, } type TProps = {