├── src ├── react-app-env.d.ts ├── images │ ├── icons │ │ ├── icon-72x72.png │ │ ├── icon-96x96.png │ │ ├── icon-128x128.png │ │ ├── icon-144x144.png │ │ ├── icon-152x152.png │ │ ├── icon-192x192.png │ │ ├── icon-384x384.png │ │ └── icon-512x512.png │ └── JWLogo.svg ├── components │ ├── Center.tsx │ ├── BottomNav.tsx │ └── Header.tsx ├── index.tsx ├── redux │ └── store.ts ├── index.css ├── App.tsx └── features │ └── flashcard │ ├── CardList.tsx │ ├── flashCardSlice.ts │ ├── FlashCard.tsx │ └── CreateFlashCard.tsx ├── public ├── robots.txt ├── favicon.ico ├── favicon-16x16.png ├── favicon-32x32.png ├── mstile-144x144.png ├── mstile-150x150.png ├── apple-touch-icon.png ├── android-chrome-192x192.png ├── android-chrome-512x512.png ├── browserconfig.xml ├── site.webmanifest ├── safari-pinned-tab.svg ├── manifest.json └── index.html ├── .gitignore ├── tsconfig.json ├── package.json ├── README.md └── LICENSE.md /src/react-app-env.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | -------------------------------------------------------------------------------- /public/robots.txt: -------------------------------------------------------------------------------- 1 | # https://www.robotstxt.org/robotstxt.html 2 | User-agent: * 3 | -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JordanWinslow/flash-cards/HEAD/public/favicon.ico -------------------------------------------------------------------------------- /public/favicon-16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JordanWinslow/flash-cards/HEAD/public/favicon-16x16.png -------------------------------------------------------------------------------- /public/favicon-32x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JordanWinslow/flash-cards/HEAD/public/favicon-32x32.png -------------------------------------------------------------------------------- /public/mstile-144x144.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JordanWinslow/flash-cards/HEAD/public/mstile-144x144.png -------------------------------------------------------------------------------- /public/mstile-150x150.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JordanWinslow/flash-cards/HEAD/public/mstile-150x150.png -------------------------------------------------------------------------------- /public/apple-touch-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JordanWinslow/flash-cards/HEAD/public/apple-touch-icon.png -------------------------------------------------------------------------------- /src/images/icons/icon-72x72.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JordanWinslow/flash-cards/HEAD/src/images/icons/icon-72x72.png -------------------------------------------------------------------------------- /src/images/icons/icon-96x96.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JordanWinslow/flash-cards/HEAD/src/images/icons/icon-96x96.png -------------------------------------------------------------------------------- /public/android-chrome-192x192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JordanWinslow/flash-cards/HEAD/public/android-chrome-192x192.png -------------------------------------------------------------------------------- /public/android-chrome-512x512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JordanWinslow/flash-cards/HEAD/public/android-chrome-512x512.png -------------------------------------------------------------------------------- /src/images/icons/icon-128x128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JordanWinslow/flash-cards/HEAD/src/images/icons/icon-128x128.png -------------------------------------------------------------------------------- /src/images/icons/icon-144x144.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JordanWinslow/flash-cards/HEAD/src/images/icons/icon-144x144.png -------------------------------------------------------------------------------- /src/images/icons/icon-152x152.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JordanWinslow/flash-cards/HEAD/src/images/icons/icon-152x152.png -------------------------------------------------------------------------------- /src/images/icons/icon-192x192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JordanWinslow/flash-cards/HEAD/src/images/icons/icon-192x192.png -------------------------------------------------------------------------------- /src/images/icons/icon-384x384.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JordanWinslow/flash-cards/HEAD/src/images/icons/icon-384x384.png -------------------------------------------------------------------------------- /src/images/icons/icon-512x512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JordanWinslow/flash-cards/HEAD/src/images/icons/icon-512x512.png -------------------------------------------------------------------------------- /src/components/Center.tsx: -------------------------------------------------------------------------------- 1 | import styled from "styled-components" 2 | 3 | export const Center = styled.div` 4 | display: flex; 5 | justify-content: center; 6 | align-items: center; 7 | width: 100vw; 8 | height: 100vh; 9 | ` 10 | -------------------------------------------------------------------------------- /public/browserconfig.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | #da532c 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.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 | -------------------------------------------------------------------------------- /src/index.tsx: -------------------------------------------------------------------------------- 1 | import React from "react" 2 | import ReactDOM from "react-dom" 3 | import { Provider } from "react-redux" 4 | import { BrowserRouter as Router } from "react-router-dom" 5 | import store from "./redux/store" 6 | 7 | import "./index.css" 8 | import App from "./App" 9 | 10 | ReactDOM.render( 11 | 12 | 13 | 14 | 15 | , 16 | document.getElementById("root") 17 | ) 18 | -------------------------------------------------------------------------------- /public/site.webmanifest: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Jordan Winslow", 3 | "short_name": "Jordan Winslow", 4 | "icons": [ 5 | { 6 | "src": "/android-chrome-192x192.png", 7 | "sizes": "192x192", 8 | "type": "image/png" 9 | }, 10 | { 11 | "src": "/android-chrome-512x512.png", 12 | "sizes": "512x512", 13 | "type": "image/png" 14 | } 15 | ], 16 | "theme_color": "#1d1818", 17 | "background_color": "#1d1818", 18 | "display": "standalone" 19 | } 20 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es5", 4 | "lib": [ 5 | "dom", 6 | "dom.iterable", 7 | "esnext" 8 | ], 9 | "allowJs": true, 10 | "skipLibCheck": false, 11 | "esModuleInterop": true, 12 | "allowSyntheticDefaultImports": true, 13 | "strict": true, 14 | "forceConsistentCasingInFileNames": true, 15 | "module": "esnext", 16 | "moduleResolution": "node", 17 | "resolveJsonModule": true, 18 | "isolatedModules": true, 19 | "noEmit": true, 20 | "jsx": "react" 21 | }, 22 | "include": [ 23 | "src" 24 | ] 25 | } 26 | -------------------------------------------------------------------------------- /src/redux/store.ts: -------------------------------------------------------------------------------- 1 | import { configureStore, getDefaultMiddleware, combineReducers } from "@reduxjs/toolkit" 2 | 3 | import flashCardsReducer from "../features/flashcard/flashCardSlice" 4 | 5 | const store = configureStore({ 6 | reducer: combineReducers({ 7 | flashCards: flashCardsReducer 8 | /*favoriteCards: favoriteCardsSlice*/ 9 | }), 10 | middleware: getDefaultMiddleware(), // this is redundant and for demonstration only 11 | devTools: true // this is redundant and for demonstration only 12 | //preloadedState: {your state object for initialization or rehydration} 13 | }) 14 | 15 | export default store 16 | export type RootState = ReturnType 17 | -------------------------------------------------------------------------------- /src/index.css: -------------------------------------------------------------------------------- 1 | html { 2 | --black: #1e1e1e; 3 | --white: #fafafa; 4 | } 5 | body { 6 | margin: 0; 7 | font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", 8 | "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", 9 | sans-serif; 10 | -webkit-font-smoothing: antialiased; 11 | -moz-osx-font-smoothing: grayscale; 12 | } 13 | 14 | code { 15 | font-family: source-code-pro, Menlo, Monaco, Consolas, "Courier New", 16 | monospace; 17 | } 18 | 19 | .fadeInOut { 20 | animation-name: fadeInOut; 21 | animation-duration: 1s; 22 | animation-timing-function: ease-in-out; 23 | animation-fill-mode: forwards; 24 | } 25 | @keyframes fadeInOut { 26 | 0% { 27 | opacity: 1; 28 | } 29 | 50% { 30 | opacity: 0; 31 | } 32 | 100% { 33 | opacity: 1; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /public/safari-pinned-tab.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "react-flash-cards", 3 | "version": "0.1.0", 4 | "private": true, 5 | "dependencies": { 6 | "@material-ui/core": "^4.8.2", 7 | "@material-ui/icons": "^4.5.1", 8 | "@reduxjs/toolkit": "^1.2.1", 9 | "@testing-library/jest-dom": "^4.2.4", 10 | "@testing-library/react": "^9.4.0", 11 | "@testing-library/user-event": "^7.2.1", 12 | "@types/jest": "^24.0.25", 13 | "@types/node": "^12.12.22", 14 | "@types/react": "^16.9.17", 15 | "@types/react-dom": "^16.9.4", 16 | "@types/react-redux": "^7.1.5", 17 | "@types/react-router-dom": "^5.1.3", 18 | "@types/styled-components": "4.1.8", 19 | "react": "^16.12.0", 20 | "react-card-flip": "^1.0.10", 21 | "react-dom": "^16.12.0", 22 | "react-hook-form": "^4.4.2", 23 | "react-redux": "^7.1.3", 24 | "react-router-dom": "^5.1.2", 25 | "react-scripts": "3.3.0", 26 | "redux": "^4.0.5", 27 | "styled-components": "^4.4.1", 28 | "typeface-roboto": "0.0.75", 29 | "typescript": "^3.7.4" 30 | }, 31 | "scripts": { 32 | "start": "react-scripts start", 33 | "build": "react-scripts build", 34 | "test": "react-scripts test", 35 | "eject": "react-scripts eject" 36 | }, 37 | "eslintConfig": { 38 | "extends": "react-app" 39 | }, 40 | "browserslist": { 41 | "production": [ 42 | ">0.2%", 43 | "not dead", 44 | "not op_mini all" 45 | ], 46 | "development": [ 47 | "last 1 chrome version", 48 | "last 1 firefox version", 49 | "last 1 safari version" 50 | ] 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /public/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Flash Cards by Jordan Winslow", 3 | "short_name": "Flash Cards", 4 | "icons": [ 5 | { 6 | "src": "/android-chrome-192x192.png", 7 | "sizes": "192x192", 8 | "type": "image/png" 9 | }, 10 | { 11 | "src": "/android-chrome-512x512.png", 12 | "sizes": "512x512", 13 | "type": "image/png" 14 | }, 15 | { 16 | "src": "images/icons/icon-72x72.png", 17 | "sizes": "72x72", 18 | "type": "image/png" 19 | }, 20 | { 21 | "src": "images/icons/icon-96x96.png", 22 | "sizes": "96x96", 23 | "type": "image/png" 24 | }, 25 | { 26 | "src": "images/icons/icon-128x128.png", 27 | "sizes": "128x128", 28 | "type": "image/png" 29 | }, 30 | { 31 | "src": "images/icons/icon-144x144.png", 32 | "sizes": "144x144", 33 | "type": "image/png" 34 | }, 35 | { 36 | "src": "images/icons/icon-152x152.png", 37 | "sizes": "152x152", 38 | "type": "image/png" 39 | }, 40 | { 41 | "src": "images/icons/icon-192x192.png", 42 | "sizes": "192x192", 43 | "type": "image/png" 44 | }, 45 | { 46 | "src": "images/icons/icon-384x384.png", 47 | "sizes": "384x384", 48 | "type": "image/png" 49 | }, 50 | { 51 | "src": "images/icons/icon-512x512.png", 52 | "sizes": "512x512", 53 | "type": "image/png" 54 | } 55 | ], 56 | "splash_pages": null, 57 | "theme_color": "#35b985", 58 | "background_color": "#131516", 59 | "display": "fullscreen", 60 | "orientation": "portrait", 61 | "scope": "/", 62 | "start_url": "." 63 | } 64 | -------------------------------------------------------------------------------- /public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 20 | 21 | Flash Cards by Jordan Winslow 22 | 23 | 24 | 25 |
26 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /src/App.tsx: -------------------------------------------------------------------------------- 1 | /* 2 | Author: Jordan Winslow 3 | Website: https://JordanWinslow.dev 4 | License: Attribution-NonCommercial-ShareAlike 4.0 International 5 | https://creativecommons.org/licenses/by-nc-sa/4.0/ 6 | */ 7 | 8 | import React from "react" 9 | import { useSelector, useDispatch } from "react-redux" 10 | import { Route } from "react-router-dom" 11 | 12 | import { 13 | nextFlashCard, 14 | prevFlashCard 15 | } from "./features/flashcard/flashCardSlice" 16 | 17 | import BottomNav from "./components/BottomNav" 18 | import FlashCard from "./features/flashcard/FlashCard" 19 | import CreateFlashCard from "./features/flashcard/CreateFlashCard" 20 | 21 | import { Grid } from "@material-ui/core" 22 | import { Center } from "./components/Center" 23 | import Header from "./components/Header" 24 | 25 | import { RootState } from "./redux/store" // this is a Type declaration 26 | 27 | /**********************APPLICATION**********************/ 28 | const App: React.FC = () => { 29 | const dispatch = useDispatch() 30 | const cards = useSelector((state: RootState) => state.flashCards.cards) 31 | const current = useSelector((state: RootState) => state.flashCards.current) 32 | 33 | return ( 34 | <> 35 |
36 | 37 |
38 | 39 | 44 | 45 |
46 | dispatch(nextFlashCard())} 48 | prevCard={() => dispatch(prevFlashCard())} 49 | /> 50 |
51 | 52 | 53 | 54 | 55 | 56 | ) 57 | } 58 | 59 | export default App 60 | -------------------------------------------------------------------------------- /src/components/BottomNav.tsx: -------------------------------------------------------------------------------- 1 | import React from "react" 2 | import { useHistory } from "react-router-dom" 3 | 4 | import { makeStyles } from "@material-ui/core/styles" 5 | import BottomNavigation from "@material-ui/core/BottomNavigation" 6 | import BottomNavigationAction from "@material-ui/core/BottomNavigationAction" 7 | import PreviousIcon from "@material-ui/icons/ArrowBackIos" 8 | import NextIcon from "@material-ui/icons/ArrowForwardIos" 9 | import AddIcon from "@material-ui/icons/AddToPhotos" 10 | import CancelIcon from "@material-ui/icons/Cancel" 11 | 12 | const useStyles = makeStyles({ 13 | displayMode: { 14 | position: "fixed", 15 | bottom: 0, 16 | width: "100%" 17 | }, 18 | createMode: { 19 | position: "absolute", 20 | top: "calc(100% - 56px)", 21 | width: "100%" 22 | } 23 | }) 24 | 25 | interface NavProps { 26 | prevCard?: () => { payload: undefined; type: string } 27 | nextCard?: () => { payload: undefined; type: string } 28 | } 29 | 30 | export default function SimpleBottomNavigation({ 31 | prevCard, 32 | nextCard 33 | }: NavProps) { 34 | const style = useStyles() 35 | const history = useHistory() 36 | 37 | return ( 38 | <> 39 | {!prevCard && ( // if no props are passed, we are in create mode 40 | 41 | } 44 | onClick={() => history.goBack()} 45 | /> 46 | 47 | )} 48 | {prevCard && ( // if props exist, we are in display mode 49 | 50 | } 53 | onClick={prevCard} 54 | /> 55 | } 58 | onClick={() => history.push("/create-new-flashcard")} 59 | /> 60 | } 63 | onClick={nextCard} 64 | /> 65 | 66 | )} 67 | 68 | ) 69 | } 70 | -------------------------------------------------------------------------------- /src/images/JWLogo.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /src/features/flashcard/CardList.tsx: -------------------------------------------------------------------------------- 1 | /* import React from "react" 2 | import { useSelector, useDispatch } from "react-redux" 3 | 4 | import { createFlashCard, flipFlashCard } from "./flashCardSlice" 5 | 6 | import { 7 | Grid, 8 | Card, 9 | CardHeader, 10 | IconButton, 11 | CardContent 12 | } from "@material-ui/core" 13 | import FavoriteIcon from "@material-ui/icons/Favorite" 14 | 15 | const styles = { 16 | card: { 17 | background: 18 | "linear-gradient(45deg, rgba(86, 86, 86,0.04) 0%, rgba(86, 86, 86,0.04) 50%,rgba(169, 169, 169,0.04) 50%, rgba(169, 169, 169,0.04) 71%,rgba(251, 251, 251,0.04) 71%, rgba(251, 251, 251,0.04) 100%), linear-gradient(45deg, rgba(86, 86, 86,0.04) 0%, rgba(86, 86, 86,0.04) 56%,rgba(169, 169, 169,0.04) 56%, rgba(169, 169, 169,0.04) 67%,rgba(251, 251, 251,0.04) 67%, rgba(251, 251, 251,0.04) 100%), linear-gradient(135deg, rgba(86, 86, 86,0.04) 0%, rgba(86, 86, 86,0.04) 4%,rgba(169, 169, 169,0.04) 4%, rgba(169, 169, 169,0.04) 75%,rgba(251, 251, 251,0.04) 75%, rgba(251, 251, 251,0.04) 100%), linear-gradient(90deg, rgb(0,0,0),rgb(0,0,0))", 19 | color: "#EEEEEE", 20 | boxShadow: "0 4px 20px rgba(0,0,0, 0.5)", 21 | header: { 22 | background: 23 | "radial-gradient(circle at 17% 1%, rgba(198, 198, 198,0.03) 0%, rgba(198, 198, 198,0.03) 50%,rgba(42, 42, 42,0.03) 50%, rgba(42, 42, 42,0.03) 100%),radial-gradient(circle at 8% 81%, rgba(253, 253, 253,0.03) 0%, rgba(253, 253, 253,0.03) 50%,rgba(36, 36, 36,0.03) 50%, rgba(36, 36, 36,0.03) 100%),radial-gradient(circle at 83% 29%, rgba(164, 164, 164,0.03) 0%, rgba(164, 164, 164,0.03) 50%,rgba(60, 60, 60,0.03) 50%, rgba(60, 60, 60,0.03) 100%),radial-gradient(circle at 96% 62%, rgba(170, 170, 170,0.03) 0%, rgba(170, 170, 170,0.03) 50%,rgba(169, 169, 169,0.03) 50%, rgba(169, 169, 169,0.03) 100%),linear-gradient(338deg, rgb(2, 141, 213),rgb(5, 172, 81))" 24 | } 25 | } 26 | } 27 | 28 | const CardList: React.FC = () => { 29 | const dispatch = useDispatch() 30 | const { cards } = useSelector((state: any) => state.flashCards) 31 | 32 | return ( 33 |
34 | 40 | {cards.map((cardInfo: any) => { 41 | return ( 42 | 43 | 44 | 47 | 48 | 49 | } 50 | title={cardInfo.front.title} 51 | style={styles.card.header} 52 | /> 53 | dispatch(flipFlashCard())}> 54 | {cardInfo.front.content} 55 | 56 | 57 | 58 | ) 59 | })} 60 | 61 |
62 | ) 63 | } 64 | 65 | export default CardList 66 | */ 67 | let nothing = "" 68 | export default nothing 69 | -------------------------------------------------------------------------------- /src/components/Header.tsx: -------------------------------------------------------------------------------- 1 | import React from "react" 2 | import styled from "styled-components" 3 | 4 | import materialStyled from "@material-ui/core/styles/styled" 5 | import Toolbar from "@material-ui/core/Toolbar" 6 | import Typography from "@material-ui/core/Typography" 7 | import AppBar from "@material-ui/core/AppBar" 8 | import IconButton from "@material-ui/core/IconButton" 9 | import GitHubIcon from "@material-ui/icons/GitHub" 10 | 11 | import JWLogo from "../images/JWLogo.svg" 12 | 13 | const HeaderContainer = materialStyled(AppBar)({ 14 | background: 15 | "radial-gradient(circle at 16% 83%, rgba(148, 148, 148,0.06) 0%, rgba(148, 148, 148,0.06) 50%,rgba(63, 63, 63,0.06) 50%, rgba(63, 63, 63,0.06) 100%),radial-gradient(circle at 68% 87%, rgba(66, 66, 66,0.06) 0%, rgba(66, 66, 66,0.06) 50%,rgba(105, 105, 105,0.06) 50%, rgba(105, 105, 105,0.06) 100%),radial-gradient(circle at 38% 50%, rgba(123, 123, 123,0.06) 0%, rgba(123, 123, 123,0.06) 50%,rgba(172, 172, 172,0.06) 50%, rgba(172, 172, 172,0.06) 100%),linear-gradient(90deg, hsl(18,0%,1%),hsl(18,0%,1%))" 16 | }) 17 | 18 | const ToolTip = styled.span<{ right?: boolean }>` 19 | position: absolute; 20 | right: ${props => 21 | props.right 22 | ? "2rem" 23 | : ""}; // conditionally locate the tooltip to the right or left of the hover element 24 | pointer-events: none; 25 | opacity: 0; 26 | width: auto; 27 | background-color: var(--black); 28 | color: var(--white); 29 | text-align: center; 30 | border-radius: 6px; 31 | padding: 7px 20px; 32 | font-size: 1rem; 33 | ` 34 | 35 | const DetectHover = styled.div` 36 | transition-duration: 0.3s; 37 | /*MAKE TOOLTIP VISIBLE ON HOVER*/ 38 | span { 39 | transition: opacity 0.3s ease-in; 40 | transition-delay: 1s; 41 | } 42 | :hover { 43 | color: #fcb813; 44 | span { 45 | /******TOOLTIP******/ 46 | opacity: 1; 47 | } 48 | } 49 | ` 50 | 51 | const Header = () => { 52 | return ( 53 | 54 | 55 | 59 | 60 | 61 | Logo Link to Jordan Winslow's Portfolio 66 | Check Out My Portfolio! 67 | 68 | 69 | 70 | 71 | {window.innerWidth < 600 72 | ? "Flash Cards" 73 | : "Flash Cards | Jordan Winslow"} 74 | 75 | 84 | 85 | 86 | View Source Code on GitHub 87 | 88 | 89 | 90 | 91 | 92 | 93 | ) 94 | } 95 | 96 | export default Header 97 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## Flash Cards 2 | 3 | [![Netlify Status](https://api.netlify.com/api/v1/badges/4efe39d6-4646-4355-853e-3fa2ecd10c24/deploy-status)](https://redux-flash-cards.netlify.com) 4 | 5 | 6 | ### Create 7 | 8 | Create new flashcards by clicking the + icon in the bottom nav, filling out the front and back of the card & clicking the check mark. Validation & error feedback is not yet implemented. 9 | 10 | ### Read 11 | 12 | View flashcards by clicking the back and forward arrows in the bottom nav. See the back of a Flash Card by clicking anywhere on the card. 13 | 14 | ### Update 15 | 16 | Update is not yet implemented. 17 | 18 | ### Delete 19 | 20 | Delete any flash card by clicking the trash icon. 21 | 22 | License: Attribution-NonCommercial-ShareAlike 4.0 International 23 | https://creativecommons.org/licenses/by-nc-sa/4.0/ 24 | 25 | # Making Redux Easy With Toolkit 26 | 27 | Redux Toolkit is the official, opinionated, batteries-included toolset for efficient Redux development and is intended to be the standard way to write Redux logic. 28 | 29 | ## What Are The Core Benefits Of Using Redux Toolkit Over Vanilla Redux? 30 | 31 | - Majorly Reduces Boilerplate With Powerful Helper Functions 32 | - **createSlice() -** Eliminates the need for a constants/types file & action creators by accepting an initial state, an object full of reducer functions, a "slice name", then **automatically generating action creators and action types.** 33 | - **configureStore() -** Eliminates the need for a separate "root-reducer" file by allowing you to pass in each slice of your state as an object and running combineReducers() automatically for you. 34 | 35 | configureStore also sets up DevTools and popular middleware automatically (see next drop down for more info) and calls applyMiddleware() and compose() for you 36 | 37 | - Includes Popular Middleware & DevTools With No Setup Required 38 | 39 | Prevents common mistakes such as accidentally mutating your state or putting non-serializable data into state *(functions, promises, etc. which should be handled separate from the state logic.)* by including **redux-immutable-state-invariant**, **serializable-state-invariant-middleware**, and allows you to manage side-effects with **redux-thunk** 40 | 41 | Comes with a getDefaultMiddleware() function if you'd like to add your own middleware but still use the provided defaults. 42 | 43 | - Makes Code More Readable, Testable & Easier to Reason About 44 | 45 | Lets you write easily readable, mutative code, and replaces verbose switch/case statements with readable functions such as 46 | 47 | `newPost: (state, action) ⇒ { 48 | const newPost = action.payload 49 | state.userPosts.push(newPost) 50 | }` 51 | without actually mutating the state & causing bugs by automatically processing your code with the I**mmer** library. 52 | 53 | ## Beyond Toolkit: Simplifying Redux With React Hooks 54 | 55 | - **Before hooks** 56 | 57 | The most common way of accessing the store and dispatch functions in React was to use the **connect()()** function, supply it with a manually-created **mapStateToProps** & **mapDispatchToProps**, and then pass a huge assortment of functions & state variables directly in the component props. 58 | 59 | Now that we have hooks we can simply import **useDispatch()** & **useSelector** from react-redux and access our state & dispatch directly inside our component like 60 | 61 | `const dispatch = useDispatch()` 62 | 63 | `dispatch(myAction(myPayload))` 64 | 65 | and 66 | 67 | `const { myStateVariable } = useSelector(state ⇒ state.mySlice)` 68 | 69 | -------------------------------------------------------------------------------- /src/features/flashcard/flashCardSlice.ts: -------------------------------------------------------------------------------- 1 | import { createSlice } from "@reduxjs/toolkit" 2 | 3 | interface CardSideState { 4 | /*Title to be displayed on front of flash card in header*/ 5 | title: string 6 | /*Content such as a question, a word to be defined, etc.*/ 7 | content: string 8 | } 9 | 10 | export interface CardState { 11 | id: number 12 | front: CardSideState 13 | back: CardSideState 14 | } 15 | 16 | interface SliceState { 17 | current: number 18 | flipped: boolean 19 | cards: CardState[] 20 | }; 21 | 22 | const flashCards = createSlice({ 23 | name: "flashCards", 24 | initialState: { 25 | current: 0, // index of current visible card 26 | flipped: false, 27 | cards: [ 28 | { 29 | // State is an Array of Flashcards With a Front and Back. The id is the array index 30 | id: 0, 31 | front: { 32 | title: "Question 1", 33 | content: "What is Redux Toolkit? (click anywhere on the card to flip)" 34 | }, 35 | back: { 36 | title: "", 37 | content: 38 | "Redux Toolkit is the official, opinionated, batteries-included toolset for efficient Redux development and is intended to be the standard way to write Redux logic." 39 | } 40 | }, 41 | { 42 | // State is an Array of Flashcards With a Front and Back. The id is the array index 43 | id: 1, 44 | front: { 45 | title: "About This Project", 46 | content: 47 | "This project was built with React, React-Router, Redux, Redux Toolkit, React-Redux & a Custom Designed MaterialUI Theme" 48 | }, 49 | back: { 50 | title: "More info", 51 | content: 52 | "Click the GitHub icon in the top right of the screen to view the source code!" 53 | } 54 | } 55 | ] 56 | } as SliceState, 57 | reducers: { 58 | nextFlashCard: state => { 59 | if (state.current < state.cards.length - 1) { 60 | if (state.flipped) flashCards.caseReducers.flipFlashCard(state) // call a caseReducer from within a caseReducer 61 | state.current++ // Mutative code is possible thanks to immer running under the hood 62 | } 63 | }, 64 | prevFlashCard: state => { 65 | if (state.current !== 0) { 66 | if (state.flipped) flashCards.caseReducers.flipFlashCard(state) 67 | state.current-- 68 | } 69 | }, 70 | flipFlashCard: state => { 71 | state.flipped = !state.flipped 72 | }, 73 | createFlashCard: (state, action) => { 74 | action.payload.id = state.cards.length + 1 75 | state.cards.push(action.payload) // Flux Standard Actions convention suggests we always call it payload. With RTK you have no choice. 76 | state.current = state.cards.length - 1 // set the new card visible immediately 77 | }, 78 | // See if you can implement this somewhere in the program by adding an edit button to each card! 79 | updateFlashCard: (state, action) => { 80 | const { index, updatedCardInfo } = action.payload 81 | state.cards[index] = updatedCardInfo 82 | }, 83 | deleteFlashCard: state => { 84 | if (state.cards.length === 1) return // If there's only one card, don't allow it to be deleted 85 | if (!state.flipped) flashCards.caseReducers.flipFlashCard(state) // Ensure front of card is displayed when we change cards 86 | if (state.cards.length - 1 === state.current) { 87 | // If looking at the last card, move back 1 card before deleting so we don't reference an undefined array position 88 | state.current-- 89 | state.cards.splice(state.current + 1, 1) 90 | } else { 91 | state.cards.splice(state.current, 1) 92 | } 93 | } 94 | } 95 | }) 96 | 97 | /* const asyncNextFlashCard = state => { 98 | return async dispatch => { 99 | if (state.current < state.cards.legnth - 1) { 100 | if (state.flipped) flashCards.caseReducers.flipFlashCard(state) // call a caseReducer from within a caseReducer 101 | setTimeout(state => state.current++, 1000) // Mutative code is possible thanks to immer running under the hood 102 | } 103 | } 104 | } */ 105 | 106 | export const { 107 | nextFlashCard, 108 | prevFlashCard, 109 | flipFlashCard, 110 | createFlashCard, 111 | updateFlashCard, 112 | deleteFlashCard 113 | } = flashCards.actions 114 | export default flashCards.reducer 115 | -------------------------------------------------------------------------------- /src/features/flashcard/FlashCard.tsx: -------------------------------------------------------------------------------- 1 | /* 2 | Author: Jordan Winslow 3 | Website: https://JordanWinslow.dev 4 | License: Attribution-NonCommercial-ShareAlike 4.0 International 5 | https://creativecommons.org/licenses/by-nc-sa/4.0/ 6 | */ 7 | import React from "react" 8 | import Flip from "react-card-flip" 9 | import { useDispatch, useSelector } from "react-redux" 10 | 11 | import { flipFlashCard, deleteFlashCard, CardState } from "./flashCardSlice" 12 | 13 | import { 14 | Card, 15 | CardContent, 16 | CardHeader, 17 | IconButton, 18 | makeStyles 19 | } from "@material-ui/core" 20 | import DeleteIcon from "@material-ui/icons/Delete" 21 | import { RootState } from "../../redux/store" 22 | 23 | /* const styles = { 24 | card: { 25 | background: 26 | "linear-gradient(45deg, rgba(86, 86, 86,0.04) 0%, rgba(86, 86, 86,0.04) 50%,rgba(169, 169, 169,0.04) 50%, rgba(169, 169, 169,0.04) 71%,rgba(251, 251, 251,0.04) 71%, rgba(251, 251, 251,0.04) 100%), linear-gradient(45deg, rgba(86, 86, 86,0.04) 0%, rgba(86, 86, 86,0.04) 56%,rgba(169, 169, 169,0.04) 56%, rgba(169, 169, 169,0.04) 67%,rgba(251, 251, 251,0.04) 67%, rgba(251, 251, 251,0.04) 100%), linear-gradient(135deg, rgba(86, 86, 86,0.04) 0%, rgba(86, 86, 86,0.04) 4%,rgba(169, 169, 169,0.04) 4%, rgba(169, 169, 169,0.04) 75%,rgba(251, 251, 251,0.04) 75%, rgba(251, 251, 251,0.04) 100%), linear-gradient(90deg, rgb(0,0,0),rgb(0,0,0))", 27 | color: "#EEEEEE", 28 | boxShadow: "0 4px 20px rgba(0,0,0, 0.5)", 29 | minHeight: "45vh", 30 | header: { 31 | background: 32 | "radial-gradient(circle at 17% 1%, rgba(198, 198, 198,0.03) 0%, rgba(198, 198, 198,0.03) 50%,rgba(42, 42, 42,0.03) 50%, rgba(42, 42, 42,0.03) 100%),radial-gradient(circle at 8% 81%, rgba(253, 253, 253,0.03) 0%, rgba(253, 253, 253,0.03) 50%,rgba(36, 36, 36,0.03) 50%, rgba(36, 36, 36,0.03) 100%),radial-gradient(circle at 83% 29%, rgba(164, 164, 164,0.03) 0%, rgba(164, 164, 164,0.03) 50%,rgba(60, 60, 60,0.03) 50%, rgba(60, 60, 60,0.03) 100%),radial-gradient(circle at 96% 62%, rgba(170, 170, 170,0.03) 0%, rgba(170, 170, 170,0.03) 50%,rgba(169, 169, 169,0.03) 50%, rgba(169, 169, 169,0.03) 100%),linear-gradient(338deg, rgb(2, 141, 213),rgb(5, 172, 81))" 33 | } 34 | } 35 | } */ 36 | 37 | const useStyles = makeStyles({ 38 | root: { 39 | /* 40 | MATERIAL UI OFFICIAL METHOD FOR WRITING CSS OVERRIDES: 41 | 42 | this is why it's often better to just create your own components if you want to 43 | make your own design, rather than editing a design framework like MaterialUI. 44 | Overrides are not nearly as trivial as they should be and by the time you master 45 | their naming conventions you could have already made your own design system! 46 | */ 47 | //HEADER CONTENT OF FLASHCARD 48 | "& .MuiCardHeader-root": { 49 | color: "#EEEEEE", 50 | background: 51 | "radial-gradient(circle at 17% 1%, rgba(198, 198, 198,0.03) 0%, rgba(198, 198, 198,0.03) 50%,rgba(42, 42, 42,0.03) 50%, rgba(42, 42, 42,0.03) 100%),radial-gradient(circle at 8% 81%, rgba(253, 253, 253,0.03) 0%, rgba(253, 253, 253,0.03) 50%,rgba(36, 36, 36,0.03) 50%, rgba(36, 36, 36,0.03) 100%),radial-gradient(circle at 83% 29%, rgba(164, 164, 164,0.03) 0%, rgba(164, 164, 164,0.03) 50%,rgba(60, 60, 60,0.03) 50%, rgba(60, 60, 60,0.03) 100%),radial-gradient(circle at 96% 62%, rgba(170, 170, 170,0.03) 0%, rgba(170, 170, 170,0.03) 50%,rgba(169, 169, 169,0.03) 50%, rgba(169, 169, 169,0.03) 100%),linear-gradient(338deg, rgb(2, 141, 213),rgb(5, 172, 81))" 52 | }, //BOTTOM CONTENT OF FLASHCARD 53 | "& .MuiCardContent-root": { 54 | background: 55 | "linear-gradient(45deg, rgba(86, 86, 86,0.04) 0%, rgba(86, 86, 86,0.04) 50%,rgba(169, 169, 169,0.04) 50%, rgba(169, 169, 169,0.04) 71%,rgba(251, 251, 251,0.04) 71%, rgba(251, 251, 251,0.04) 100%), linear-gradient(45deg, rgba(86, 86, 86,0.04) 0%, rgba(86, 86, 86,0.04) 56%,rgba(169, 169, 169,0.04) 56%, rgba(169, 169, 169,0.04) 67%,rgba(251, 251, 251,0.04) 67%, rgba(251, 251, 251,0.04) 100%), linear-gradient(135deg, rgba(86, 86, 86,0.04) 0%, rgba(86, 86, 86,0.04) 4%,rgba(169, 169, 169,0.04) 4%, rgba(169, 169, 169,0.04) 75%,rgba(251, 251, 251,0.04) 75%, rgba(251, 251, 251,0.04) 100%), linear-gradient(90deg, rgb(0,0,0),rgb(0,0,0))", 56 | color: "#EEEEEE", 57 | minHeight: "25vh" 58 | }, //TRASHCAN ICON COLOR 59 | "& .MuiButtonBase-root": { 60 | color: "white" 61 | }, //TRASHCAN ICON ALIGNMENT 62 | "& .MuiCardHeader-action": { 63 | alignSelf: "auto", 64 | marginTop: 0, 65 | marginLeft: 8 66 | } 67 | } 68 | }) 69 | 70 | const FlashCard: React.FC = ({ id, front, back }) => { 71 | const classes = useStyles() // MATERIAL UI STYLING 72 | const dispatch = useDispatch() 73 | const { flipped } = useSelector((state: RootState) => state.flashCards) 74 | 75 | return ( 76 |
77 | 78 | dispatch(flipFlashCard())} 84 | > 85 | dispatch(deleteFlashCard())} 90 | > 91 | 92 | 93 | } 94 | title={front.title} 95 | className={classes.root} 96 | /* style={styles.card.header} */ 97 | /> 98 | {front.content} 99 | 100 | 101 | dispatch(flipFlashCard())} 107 | > 108 | dispatch(deleteFlashCard())} 113 | > 114 | 115 | 116 | } 117 | title={back.title} 118 | className={classes.root} 119 | /* style={styles.card.header} */ 120 | /> 121 | {back.content} 122 | 123 | 124 |
125 | ) 126 | } 127 | 128 | export default FlashCard 129 | -------------------------------------------------------------------------------- /src/features/flashcard/CreateFlashCard.tsx: -------------------------------------------------------------------------------- 1 | /* 2 | Author: Jordan Winslow 3 | Website: https://JordanWinslow.dev 4 | License: Attribution-NonCommercial-ShareAlike 4.0 International 5 | https://creativecommons.org/licenses/by-nc-sa/4.0/ 6 | */ 7 | import React from "react" 8 | import Flip from "react-card-flip" 9 | import { useDispatch, useSelector } from "react-redux" 10 | import { useForm } from "react-hook-form" 11 | import { useHistory } from "react-router-dom" 12 | 13 | import { flipFlashCard, createFlashCard, CardState } from "./flashCardSlice" 14 | 15 | import { 16 | Card, 17 | CardContent, 18 | CardHeader, 19 | IconButton, 20 | Grid, 21 | TextField, 22 | makeStyles 23 | } from "@material-ui/core" 24 | 25 | import { Center } from "../../components/Center" 26 | import CheckCircleIcon from "@material-ui/icons/CheckCircle" 27 | 28 | import { RootState } from "../../redux/store" // Type declaration 29 | 30 | /* 31 | MANUALLY OVERRIDING THE STYLES IS LESS VERBOSE BUT REQUIRES PASSING IN InputProps & InputLabelProps AND WILL NOT ALLOW FINE-TUNING: 32 | 33 | const styles = { 34 | card: { 35 | background: 36 | "linear-gradient(45deg, rgba(86, 86, 86,0.04) 0%, rgba(86, 86, 86,0.04) 50%,rgba(169, 169, 169,0.04) 50%, rgba(169, 169, 169,0.04) 71%,rgba(251, 251, 251,0.04) 71%, rgba(251, 251, 251,0.04) 100%), linear-gradient(45deg, rgba(86, 86, 86,0.04) 0%, rgba(86, 86, 86,0.04) 56%,rgba(169, 169, 169,0.04) 56%, rgba(169, 169, 169,0.04) 67%,rgba(251, 251, 251,0.04) 67%, rgba(251, 251, 251,0.04) 100%), linear-gradient(135deg, rgba(86, 86, 86,0.04) 0%, rgba(86, 86, 86,0.04) 4%,rgba(169, 169, 169,0.04) 4%, rgba(169, 169, 169,0.04) 75%,rgba(251, 251, 251,0.04) 75%, rgba(251, 251, 251,0.04) 100%), linear-gradient(90deg, rgb(0,0,0),rgb(0,0,0))", 37 | color: "#EEEEEE", 38 | boxShadow: "0 4px 20px rgba(0,0,0, 0.5)", 39 | minHeight: "45vh", 40 | header: { 41 | background: 42 | "radial-gradient(circle at 17% 1%, rgba(198, 198, 198,0.03) 0%, rgba(198, 198, 198,0.03) 50%,rgba(42, 42, 42,0.03) 50%, rgba(42, 42, 42,0.03) 100%),radial-gradient(circle at 8% 81%, rgba(253, 253, 253,0.03) 0%, rgba(253, 253, 253,0.03) 50%,rgba(36, 36, 36,0.03) 50%, rgba(36, 36, 36,0.03) 100%),radial-gradient(circle at 83% 29%, rgba(164, 164, 164,0.03) 0%, rgba(164, 164, 164,0.03) 50%,rgba(60, 60, 60,0.03) 50%, rgba(60, 60, 60,0.03) 100%),radial-gradient(circle at 96% 62%, rgba(170, 170, 170,0.03) 0%, rgba(170, 170, 170,0.03) 50%,rgba(169, 169, 169,0.03) 50%, rgba(169, 169, 169,0.03) 100%),linear-gradient(338deg, rgb(2, 141, 213),rgb(5, 172, 81))" 43 | } 44 | } 45 | } */ 46 | 47 | const useStyles = makeStyles({ 48 | root: { 49 | /* 50 | MATERIAL UI OFFICIAL METHOD FOR WRITING CSS OVERRIDES: 51 | 52 | this is why it's often better to just create your own components if you want to 53 | make your own design, rather than editing a design framework like MaterialUI. 54 | Overrides are not nearly as trivial as they should be and by the time you master 55 | their naming conventions you could have already made your own design system! 56 | */ 57 | //HEADER CONTENT OF FLASHCARD 58 | "& .MuiCardHeader-root": { 59 | background: 60 | "radial-gradient(circle at 17% 1%, rgba(198, 198, 198,0.03) 0%, rgba(198, 198, 198,0.03) 50%,rgba(42, 42, 42,0.03) 50%, rgba(42, 42, 42,0.03) 100%),radial-gradient(circle at 8% 81%, rgba(253, 253, 253,0.03) 0%, rgba(253, 253, 253,0.03) 50%,rgba(36, 36, 36,0.03) 50%, rgba(36, 36, 36,0.03) 100%),radial-gradient(circle at 83% 29%, rgba(164, 164, 164,0.03) 0%, rgba(164, 164, 164,0.03) 50%,rgba(60, 60, 60,0.03) 50%, rgba(60, 60, 60,0.03) 100%),radial-gradient(circle at 96% 62%, rgba(170, 170, 170,0.03) 0%, rgba(170, 170, 170,0.03) 50%,rgba(169, 169, 169,0.03) 50%, rgba(169, 169, 169,0.03) 100%),linear-gradient(338deg, rgb(2, 141, 213),rgb(5, 172, 81))" 61 | }, //BOTTOM CONTENT OF FLASHCARD 62 | "& .MuiCardContent-root": { 63 | background: 64 | "linear-gradient(45deg, rgba(86, 86, 86,0.04) 0%, rgba(86, 86, 86,0.04) 50%,rgba(169, 169, 169,0.04) 50%, rgba(169, 169, 169,0.04) 71%,rgba(251, 251, 251,0.04) 71%, rgba(251, 251, 251,0.04) 100%), linear-gradient(45deg, rgba(86, 86, 86,0.04) 0%, rgba(86, 86, 86,0.04) 56%,rgba(169, 169, 169,0.04) 56%, rgba(169, 169, 169,0.04) 67%,rgba(251, 251, 251,0.04) 67%, rgba(251, 251, 251,0.04) 100%), linear-gradient(135deg, rgba(86, 86, 86,0.04) 0%, rgba(86, 86, 86,0.04) 4%,rgba(169, 169, 169,0.04) 4%, rgba(169, 169, 169,0.04) 75%,rgba(251, 251, 251,0.04) 75%, rgba(251, 251, 251,0.04) 100%), linear-gradient(90deg, rgb(0,0,0),rgb(0,0,0))", 65 | color: "#EEEEEE", 66 | minHeight: "25vh" 67 | }, //NORMAL BORDER COLOR 68 | "& .MuiOutlinedInput-root .MuiOutlinedInput-notchedOutline": { 69 | borderColor: "rgba(255,255,255, 0.5)" 70 | }, //HOVER BORDER COLOR 71 | "&:hover .MuiOutlinedInput-root .MuiOutlinedInput-notchedOutline": { 72 | borderColor: "#EEEEEE" 73 | }, //FOCUSED BORDER COLOR 74 | "& .MuiOutlinedInput-root.Mui-focused .MuiOutlinedInput-notchedOutline": { 75 | borderColor: "#FFFFFF" 76 | }, //INPUT TEXT COLOR 77 | "& .MuiOutlinedInput-root": { 78 | color: "#EEEEEE" 79 | }, //INPUT LABEL TEXT COLOR 80 | "& .MuiInputLabel-root": { 81 | color: "#EEEEEE" 82 | }, //CHECKMARK COLOR 83 | "& .MuiButtonBase-root": { 84 | color: "white" 85 | }, //CHECKMARK ALIGNMENT 86 | "& .MuiCardHeader-action": { 87 | alignSelf: "auto", 88 | marginTop: 0, 89 | marginLeft: 8 90 | } 91 | } 92 | }) 93 | 94 | const CreateFlashCard: React.FC = () => { 95 | const classes = useStyles() 96 | const dispatch = useDispatch() 97 | const { flipped } = useSelector((state: RootState) => state.flashCards) 98 | const { register, handleSubmit, errors } = useForm({ 99 | validateCriteriaMode: "all" 100 | }) 101 | const history = useHistory() 102 | 103 | const onSubmit = (data: CardState) => { 104 | dispatch(createFlashCard(data)) 105 | history.goBack() 106 | } 107 | const preventFlip = ( 108 | e: 109 | | React.MouseEvent 110 | | React.MouseEvent 111 | ) => e.stopPropagation() 112 | 113 | console.log(errors) 114 | 115 | return ( 116 |
117 | 118 |
119 | 120 | dispatch(flipFlashCard())} 126 | > 127 | 135 | 136 | 137 | } 138 | title={ 139 | 159 | } 160 | /> 161 | 162 | { 163 | 181 | } 182 | 183 | 184 | dispatch(flipFlashCard())} 190 | > 191 | 199 | 200 | 201 | } 202 | title={ 203 | 223 | } 224 | /> 225 | 226 | { 227 | 245 | } 246 | 247 | 248 | 249 |
250 |
251 |
252 | ) 253 | } 254 | 255 | export default CreateFlashCard 256 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | Attribution-NonCommercial-ShareAlike 4.0 International 2 | https://creativecommons.org/licenses/by-nc-sa/4.0/ 3 | 4 | Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International Public License 5 | By exercising the Licensed Rights (defined below), You accept and agree to be bound by the terms and conditions of this Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International Public License ("Public License"). To the extent this Public License may be interpreted as a contract, You are granted the Licensed Rights in consideration of Your acceptance of these terms and conditions, and the Licensor grants You such rights in consideration of benefits the Licensor receives from making the Licensed Material available under these terms and conditions. 6 | 7 | Section 1 – Definitions. 8 | 9 | Adapted Material means material subject to Copyright and Similar Rights that is derived from or based upon the Licensed Material and in which the Licensed Material is translated, altered, arranged, transformed, or otherwise modified in a manner requiring permission under the Copyright and Similar Rights held by the Licensor. For purposes of this Public License, where the Licensed Material is a musical work, performance, or sound recording, Adapted Material is always produced where the Licensed Material is synched in timed relation with a moving image. 10 | Adapter's License means the license You apply to Your Copyright and Similar Rights in Your contributions to Adapted Material in accordance with the terms and conditions of this Public License. 11 | BY-NC-SA Compatible License means a license listed at creativecommons.org/compatiblelicenses, approved by Creative Commons as essentially the equivalent of this Public License. 12 | Copyright and Similar Rights means copyright and/or similar rights closely related to copyright including, without limitation, performance, broadcast, sound recording, and Sui Generis Database Rights, without regard to how the rights are labeled or categorized. For purposes of this Public License, the rights specified in Section 2(b)(1)-(2) are not Copyright and Similar Rights. 13 | Effective Technological Measures means those measures that, in the absence of proper authority, may not be circumvented under laws fulfilling obligations under Article 11 of the WIPO Copyright Treaty adopted on December 20, 1996, and/or similar international agreements. 14 | Exceptions and Limitations means fair use, fair dealing, and/or any other exception or limitation to Copyright and Similar Rights that applies to Your use of the Licensed Material. 15 | License Elements means the license attributes listed in the name of a Creative Commons Public License. The License Elements of this Public License are Attribution, NonCommercial, and ShareAlike. 16 | Licensed Material means the artistic or literary work, database, or other material to which the Licensor applied this Public License. 17 | Licensed Rights means the rights granted to You subject to the terms and conditions of this Public License, which are limited to all Copyright and Similar Rights that apply to Your use of the Licensed Material and that the Licensor has authority to license. 18 | Licensor means the individual(s) or entity(ies) granting rights under this Public License. 19 | NonCommercial means not primarily intended for or directed towards commercial advantage or monetary compensation. For purposes of this Public License, the exchange of the Licensed Material for other material subject to Copyright and Similar Rights by digital file-sharing or similar means is NonCommercial provided there is no payment of monetary compensation in connection with the exchange. 20 | Share means to provide material to the public by any means or process that requires permission under the Licensed Rights, such as reproduction, public display, public performance, distribution, dissemination, communication, or importation, and to make material available to the public including in ways that members of the public may access the material from a place and at a time individually chosen by them. 21 | Sui Generis Database Rights means rights other than copyright resulting from Directive 96/9/EC of the European Parliament and of the Council of 11 March 1996 on the legal protection of databases, as amended and/or succeeded, as well as other essentially equivalent rights anywhere in the world. 22 | You means the individual or entity exercising the Licensed Rights under this Public License. Your has a corresponding meaning. 23 | Section 2 – Scope. 24 | 25 | License grant. 26 | Subject to the terms and conditions of this Public License, the Licensor hereby grants You a worldwide, royalty-free, non-sublicensable, non-exclusive, irrevocable license to exercise the Licensed Rights in the Licensed Material to: 27 | reproduce and Share the Licensed Material, in whole or in part, for NonCommercial purposes only; and 28 | produce, reproduce, and Share Adapted Material for NonCommercial purposes only. 29 | Exceptions and Limitations. For the avoidance of doubt, where Exceptions and Limitations apply to Your use, this Public License does not apply, and You do not need to comply with its terms and conditions. 30 | Term. The term of this Public License is specified in Section 6(a). 31 | Media and formats; technical modifications allowed. The Licensor authorizes You to exercise the Licensed Rights in all media and formats whether now known or hereafter created, and to make technical modifications necessary to do so. The Licensor waives and/or agrees not to assert any right or authority to forbid You from making technical modifications necessary to exercise the Licensed Rights, including technical modifications necessary to circumvent Effective Technological Measures. For purposes of this Public License, simply making modifications authorized by this Section 2(a)(4) never produces Adapted Material. 32 | Downstream recipients. 33 | Offer from the Licensor – Licensed Material. Every recipient of the Licensed Material automatically receives an offer from the Licensor to exercise the Licensed Rights under the terms and conditions of this Public License. 34 | Additional offer from the Licensor – Adapted Material. Every recipient of Adapted Material from You automatically receives an offer from the Licensor to exercise the Licensed Rights in the Adapted Material under the conditions of the Adapter’s License You apply. 35 | No downstream restrictions. You may not offer or impose any additional or different terms or conditions on, or apply any Effective Technological Measures to, the Licensed Material if doing so restricts exercise of the Licensed Rights by any recipient of the Licensed Material. 36 | No endorsement. Nothing in this Public License constitutes or may be construed as permission to assert or imply that You are, or that Your use of the Licensed Material is, connected with, or sponsored, endorsed, or granted official status by, the Licensor or others designated to receive attribution as provided in Section 3(a)(1)(A)(i). 37 | Other rights. 38 | 39 | Moral rights, such as the right of integrity, are not licensed under this Public License, nor are publicity, privacy, and/or other similar personality rights; however, to the extent possible, the Licensor waives and/or agrees not to assert any such rights held by the Licensor to the limited extent necessary to allow You to exercise the Licensed Rights, but not otherwise. 40 | Patent and trademark rights are not licensed under this Public License. 41 | To the extent possible, the Licensor waives any right to collect royalties from You for the exercise of the Licensed Rights, whether directly or through a collecting society under any voluntary or waivable statutory or compulsory licensing scheme. In all other cases the Licensor expressly reserves any right to collect such royalties, including when the Licensed Material is used other than for NonCommercial purposes. 42 | Section 3 – License Conditions. 43 | 44 | Your exercise of the Licensed Rights is expressly made subject to the following conditions. 45 | 46 | Attribution. 47 | 48 | If You Share the Licensed Material (including in modified form), You must: 49 | 50 | retain the following if it is supplied by the Licensor with the Licensed Material: 51 | identification of the creator(s) of the Licensed Material and any others designated to receive attribution, in any reasonable manner requested by the Licensor (including by pseudonym if designated); 52 | a copyright notice; 53 | a notice that refers to this Public License; 54 | a notice that refers to the disclaimer of warranties; 55 | a URI or hyperlink to the Licensed Material to the extent reasonably practicable; 56 | indicate if You modified the Licensed Material and retain an indication of any previous modifications; and 57 | indicate the Licensed Material is licensed under this Public License, and include the text of, or the URI or hyperlink to, this Public License. 58 | You may satisfy the conditions in Section 3(a)(1) in any reasonable manner based on the medium, means, and context in which You Share the Licensed Material. For example, it may be reasonable to satisfy the conditions by providing a URI or hyperlink to a resource that includes the required information. 59 | If requested by the Licensor, You must remove any of the information required by Section 3(a)(1)(A) to the extent reasonably practicable. 60 | ShareAlike. 61 | In addition to the conditions in Section 3(a), if You Share Adapted Material You produce, the following conditions also apply. 62 | 63 | The Adapter’s License You apply must be a Creative Commons license with the same License Elements, this version or later, or a BY-NC-SA Compatible License. 64 | You must include the text of, or the URI or hyperlink to, the Adapter's License You apply. You may satisfy this condition in any reasonable manner based on the medium, means, and context in which You Share Adapted Material. 65 | You may not offer or impose any additional or different terms or conditions on, or apply any Effective Technological Measures to, Adapted Material that restrict exercise of the rights granted under the Adapter's License You apply. 66 | Section 4 – Sui Generis Database Rights. 67 | 68 | Where the Licensed Rights include Sui Generis Database Rights that apply to Your use of the Licensed Material: 69 | 70 | for the avoidance of doubt, Section 2(a)(1) grants You the right to extract, reuse, reproduce, and Share all or a substantial portion of the contents of the database for NonCommercial purposes only; 71 | if You include all or a substantial portion of the database contents in a database in which You have Sui Generis Database Rights, then the database in which You have Sui Generis Database Rights (but not its individual contents) is Adapted Material, including for purposes of Section 3(b); and 72 | You must comply with the conditions in Section 3(a) if You Share all or a substantial portion of the contents of the database. 73 | For the avoidance of doubt, this Section 4 supplements and does not replace Your obligations under this Public License where the Licensed Rights include other Copyright and Similar Rights. 74 | Section 5 – Disclaimer of Warranties and Limitation of Liability. 75 | 76 | Unless otherwise separately undertaken by the Licensor, to the extent possible, the Licensor offers the Licensed Material as-is and as-available, and makes no representations or warranties of any kind concerning the Licensed Material, whether express, implied, statutory, or other. This includes, without limitation, warranties of title, merchantability, fitness for a particular purpose, non-infringement, absence of latent or other defects, accuracy, or the presence or absence of errors, whether or not known or discoverable. Where disclaimers of warranties are not allowed in full or in part, this disclaimer may not apply to You. 77 | To the extent possible, in no event will the Licensor be liable to You on any legal theory (including, without limitation, negligence) or otherwise for any direct, special, indirect, incidental, consequential, punitive, exemplary, or other losses, costs, expenses, or damages arising out of this Public License or use of the Licensed Material, even if the Licensor has been advised of the possibility of such losses, costs, expenses, or damages. Where a limitation of liability is not allowed in full or in part, this limitation may not apply to You. 78 | The disclaimer of warranties and limitation of liability provided above shall be interpreted in a manner that, to the extent possible, most closely approximates an absolute disclaimer and waiver of all liability. 79 | Section 6 – Term and Termination. 80 | 81 | This Public License applies for the term of the Copyright and Similar Rights licensed here. However, if You fail to comply with this Public License, then Your rights under this Public License terminate automatically. 82 | Where Your right to use the Licensed Material has terminated under Section 6(a), it reinstates: 83 | 84 | automatically as of the date the violation is cured, provided it is cured within 30 days of Your discovery of the violation; or 85 | upon express reinstatement by the Licensor. 86 | For the avoidance of doubt, this Section 6(b) does not affect any right the Licensor may have to seek remedies for Your violations of this Public License. 87 | For the avoidance of doubt, the Licensor may also offer the Licensed Material under separate terms or conditions or stop distributing the Licensed Material at any time; however, doing so will not terminate this Public License. 88 | Sections 1, 5, 6, 7, and 8 survive termination of this Public License. 89 | Section 7 – Other Terms and Conditions. 90 | 91 | The Licensor shall not be bound by any additional or different terms or conditions communicated by You unless expressly agreed. 92 | Any arrangements, understandings, or agreements regarding the Licensed Material not stated herein are separate from and independent of the terms and conditions of this Public License. 93 | Section 8 – Interpretation. 94 | 95 | For the avoidance of doubt, this Public License does not, and shall not be interpreted to, reduce, limit, restrict, or impose conditions on any use of the Licensed Material that could lawfully be made without permission under this Public License. 96 | To the extent possible, if any provision of this Public License is deemed unenforceable, it shall be automatically reformed to the minimum extent necessary to make it enforceable. If the provision cannot be reformed, it shall be severed from this Public License without affecting the enforceability of the remaining terms and conditions. 97 | No term or condition of this Public License will be waived and no failure to comply consented to unless expressly agreed to by the Licensor. 98 | Nothing in this Public License constitutes or may be interpreted as a limitation upon, or waiver of, any privileges and immunities that apply to the Licensor or You, including from the legal processes of any jurisdiction or authority. 99 | Creative Commons is not a party to its public licenses. Notwithstanding, Creative Commons may elect to apply one of its public licenses to material it publishes and in those instances will be considered the “Licensor.” The text of the Creative Commons public licenses is dedicated to the public domain under the CC0 Public Domain Dedication. Except for the limited purpose of indicating that material is shared under a Creative Commons public license or as otherwise permitted by the Creative Commons policies published at creativecommons.org/policies, Creative Commons does not authorize the use of the trademark “Creative Commons” or any other trademark or logo of Creative Commons without its prior written consent including, without limitation, in connection with any unauthorized modifications to any of its public licenses or any other arrangements, understandings, or agreements concerning use of licensed material. For the avoidance of doubt, this paragraph does not form part of the public licenses. 100 | 101 | Creative Commons may be contacted at creativecommons.org. 102 | --------------------------------------------------------------------------------