diff --git a/src/assets/icons/chevron-left.svg b/src/assets/icons/chevron-left.svg new file mode 100644 index 0000000..3c4e525 --- /dev/null +++ b/src/assets/icons/chevron-left.svg @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/src/assets/icons/speaker.svg b/src/assets/icons/speaker.svg index fcdba0b..36092ef 100644 --- a/src/assets/icons/speaker.svg +++ b/src/assets/icons/speaker.svg @@ -1,3 +1,3 @@ - + diff --git a/src/components/add-word/AddWord.module.scss b/src/components/add-word/AddWord.module.scss new file mode 100644 index 0000000..003bf01 --- /dev/null +++ b/src/components/add-word/AddWord.module.scss @@ -0,0 +1,224 @@ +.modalPage { + background-color: var(--creamy-white); + position: fixed; + top: 0; + left: 0; + z-index: 2; + width: 100vw; + height: 100vh; + overflow: auto; + opacity: 0; + animation: fadeIn 0.3s forwards; + + @keyframes fadeIn { + 0% { + opacity: 0; + transform: translateY(10vh); + } 100% { + opacity: 1; + transform: translateY(0vh); + } + } +} + +.navHeader { + background-color: transparent; + text-align: center; + position: relative; + display: flex; + justify-content: space-between; + align-items: center; + padding: 1rem 1.5rem; + + button { + width: 4rem; + text-align: center; + background-color: transparent; + border: 0; + display: flex; + align-items: center; + justify-content: flex-start; + + svg { + width: 1rem; + color: var(--black); + } + } + + h5 { + font-size: 1.5rem; + } + + figure { + display: block; + + img { + display: block; + width: 4rem; + height: 4rem; + border-radius: 50%; + border: 1px solid var(--creamy-white); + } + } +} + +.searchBarHolder { + background-color: var(--teal); + padding: 2rem 0 6rem; + border-top-right-radius: 3rem; + border-top-left-radius: 3rem; + + .searchBar { + background-color: white; + display: flex; + border-radius: 3rem; + height: 5rem; + width: calc(100% - 6rem); + margin: 0 auto; + align-items: center; + justify-content: space-between; + box-shadow: 0px 5px 30px -20px var(--grey); + + input { + height: 100%; + border: 0; + width: calc(100% - 5rem); + background-color: transparent; + padding-left: 2rem; + font-size: 1.4rem; + } + + svg { + width: 5rem; + fill: var(--red); + } + } +} + +.searchResult { + background-color: var(--creamy-white); + border-top-right-radius: 3rem; + border-top-left-radius: 3rem; + margin: -4rem 0; + min-height: 5rem; + padding: 2rem; + + li { + position: relative; + overflow: hidden; + border-radius: 2rem; + padding: 1rem 1.5rem; + margin-bottom: 1.5rem; + + &:nth-child(2n) { + &::before { + background-color: var(--teal); + } + + header { + h4 { + span { + color: var(--teal); + } + } + } + + .description { + span, p { + color: var(--teal); + } + } + } + + &::before { + content: ''; + position: absolute; + left: 0; + top: 0; + width: 100%; + height: 100%; + background-color: var(--orange); + opacity: 0.3; + } + + &>* { + position: relative; + } + + header { + display: flex; + align-items: flex-start; + justify-content: space-between; + + h4 { + font-size: 2rem; + font-weight: 600; + color: var(--black); + + span { + display: block; + font-size: 1.2rem; + color: var(--orange); + filter: brightness(50%); + font-weight: 500; + } + } + + button { + background-color: transparent; + border: none; + background-color: var(--orange); + width: 4rem; + height: 4rem; + border-radius: 50%; + display: flex; + align-items: center; + justify-content: center; + + svg { + width: 1.7rem; + fill: white; + } + } + } + + .description { + margin: 1rem 0; + filter: brightness(40%); + opacity: 0.7; + + span { + font-size: 1.2rem; + color: var(--orange); + font-weight: 600; + text-transform: lowercase; + } + + p { + font-size: 1.2rem; + color: var(--orange); + } + } + + .addButton { + width: 7rem; + margin-left: auto; + border: none; + border-radius: 3rem; + height: 3rem; + cursor: pointer; + display: flex; + align-items: center; + justify-content: center; + font-size: 1.2rem; + color: white; + background-color: var(--orange); + + svg { + fill: white; + width: 1rem; + margin-right: 0.5rem; + } + } + } +} \ No newline at end of file diff --git a/src/components/add-word/AddWord.tsx b/src/components/add-word/AddWord.tsx new file mode 100644 index 0000000..40770c8 --- /dev/null +++ b/src/components/add-word/AddWord.tsx @@ -0,0 +1,68 @@ +import React, { useState } from "react"; +import styles from './AddWord.module.scss'; +import { ReactComponent as ChevronLeft } from '../../assets/icons/chevron-left.svg'; +import { ReactComponent as SearchIcon } from '../../assets/icons/bx-search-alt.svg'; +import { ReactComponent as SpeakerIcon } from '../../assets/icons/speaker.svg'; +import { ReactComponent as AddIcon } from '../../assets/icons/plus.svg'; + +import { IWord } from "../../structure/word"; +import { ALL_WORDS } from "../../data/all-words"; + +type OwnProps = { + hideModal: () => void; +}; + +export const AddWord: React.FC = (props: OwnProps) => { + const [searchResult, setSearchResult] = useState>([]); + + const searchWords = (searchWord: string) => { + if (searchWord.length > 0) { + let result = ALL_WORDS.filter((word) => { + return word.name.toLowerCase().includes(searchWord.toLowerCase()); + }); + + setSearchResult(result); + } else { + setSearchResult([]); + } + } + + return + + + + + Add a Word + + + {/* eslint-disable-next-line */} + + + + + + + searchWords(event.currentTarget.value)} /> + + + + + + { searchResult.map((word) => { + return + + { word.name } { word.pronounciation } + + + + + + { word.grammaticalDetails[0].typeName } + { word.grammaticalDetails[0].description } + + Add + + }) } + + +} \ No newline at end of file diff --git a/src/components/home/Home.tsx b/src/components/home/Home.tsx index e7e6987..da557aa 100644 --- a/src/components/home/Home.tsx +++ b/src/components/home/Home.tsx @@ -1,4 +1,4 @@ -import React from "react"; +import React, { useState } from "react"; import styles from './Home.module.scss'; import { ReactComponent as LogoIcon } from '../../assets/icons/anamnesis.svg'; import { ReactComponent as SearchIcon } from '../../assets/icons/bx-search-alt.svg'; @@ -15,11 +15,13 @@ import { ReactComponent as GridIcon } from '../../assets/icons/circled.svg'; import { ReactComponent as PersonSpeakerIcon } from '../../assets/icons/user-speaker.svg'; import { ReactComponent as BrainIcon } from '../../assets/icons/bx-brain.svg'; import { ReactComponent as InternBadge } from '../../assets/icons/intern-badge.svg'; - import { CircularProgressbar } from 'react-circular-progressbar'; +import { AddWord } from "../add-word/AddWord"; export const Home: React.FC = () => { + const [isAddWordModalOpen, setAddWordModalState] = useState(false); + return @@ -57,7 +59,7 @@ export const Home: React.FC = () => { - + setAddWordModalState(true)} /> @@ -252,5 +254,8 @@ export const Home: React.FC = () => { + + { isAddWordModalOpen && { setAddWordModalState(false); }} /> } + } \ No newline at end of file diff --git a/src/components/tabs/Tabs.tsx b/src/components/tabs/Tabs.tsx index 7492770..d0bb41e 100644 --- a/src/components/tabs/Tabs.tsx +++ b/src/components/tabs/Tabs.tsx @@ -9,7 +9,7 @@ import { ReactComponent as MoreIcon } from '../../assets/icons/more-vertical.svg import { NavLink } from "react-router-dom"; export const Tabs: React.FC = () => { - return + return diff --git a/src/data/all-words.ts b/src/data/all-words.ts new file mode 100644 index 0000000..833f075 --- /dev/null +++ b/src/data/all-words.ts @@ -0,0 +1,27 @@ +import { IWord } from "../structure/word"; + +export const ALL_WORDS: Array = [{ + name: 'Pleasure', + pronounciation: '/ˈplɛʒə/', + audioPronounciationURL: '', + grammaticalDetails: [{ + typeName: 'NOUN', + description: 'a feeling of happy satisfaction and enjoyment.' + }, { + typeName: 'ADJECTIVE', + description: 'used or intended for entertainment rather than business.' + }], + similarWords: ['Happiness', 'Delight', 'Joy', 'Rapture', 'Glee'], +}, { + name: 'Please', + pronounciation: '/pliːz/', + audioPronounciationURL: '', + grammaticalDetails: [{ + typeName: 'VERB', + description: 'cause to feel happy and satisfied.' + }, { + typeName: 'ADVERB', + description: 'used in polite requests or questions.' + }], + similarWords: ['Nice', 'Agreeable', 'Pleasant', 'Satisfying', 'Gratifying'], +}] \ No newline at end of file diff --git a/src/structure/word.ts b/src/structure/word.ts index 78c94f7..7e7c634 100644 --- a/src/structure/word.ts +++ b/src/structure/word.ts @@ -3,7 +3,7 @@ export type IWord = { pronounciation: string, audioPronounciationURL: string, grammaticalDetails: Array<{ - typeName: 'NOUN' | 'ADJECTIVE' | 'VERB', + typeName: 'NOUN' | 'ADJECTIVE' | 'VERB' | 'ADVERB', description: string, }>, similarWords: Array
{ word.grammaticalDetails[0].description }