diff --git a/src/components/add-shelf/AddShelf.module.scss b/src/components/add-shelf/AddShelf.module.scss index ad1382c..9fd5128 100644 --- a/src/components/add-shelf/AddShelf.module.scss +++ b/src/components/add-shelf/AddShelf.module.scss @@ -145,6 +145,30 @@ justify-content: space-between; align-items: center; margin: 1rem 0; + position: relative; + transition: opacity 0.3s; + + &.inactive { + opacity: 0.5; + } + + .checkmark { + position: absolute; + left: 3.5rem; + top: -0.3rem; + width: 1.5rem; + height: 1.5rem; + background-color: var(--teal); + border-radius: 50%; + display: flex; + align-items: center; + justify-content: center; + + svg { + width: 0.8rem; + fill: white; + } + } &:nth-child(1) .icon { background-color: var(--orange); @@ -217,14 +241,27 @@ height: 2rem; border-radius: 3rem; box-shadow: 0px 0px 10px -5px inset var(--light-grey); + display: flex; + align-items: center; + justify-content: flex-start; + + &.on span { + transform: translateX(2.2rem); + background-color: var(--teal); + } + + &.off span { + transform: translateX(0.2rem); + } span { - width: 2rem; - height: 2rem; + cursor: pointer; + width: 1.6rem; + height: 1.6rem; background-color: var(--red); border-radius: 50%; display: block; - transform: scale(0.8); + transition: transform 0.3s, background-color 0.3s; } } } diff --git a/src/components/add-shelf/AddShelf.tsx b/src/components/add-shelf/AddShelf.tsx index b35cfd3..5765b07 100644 --- a/src/components/add-shelf/AddShelf.tsx +++ b/src/components/add-shelf/AddShelf.tsx @@ -1,10 +1,21 @@ -import React from "react"; +import React, { useState } from "react"; import styles from './AddShelf.module.scss'; import { ReactComponent as CloseIcon } from '../../assets/icons/close.svg'; import { ReactComponent as PlusIcon } from '../../assets/icons/plus.svg'; +import { ReactComponent as CheckCircle } from '../../assets/icons/check.svg'; import { userProfileData } from "../home/Home"; +import { IShelf } from "../../structure/shelf"; export const AddShelf: React.FC = () => { + const [selectedCategoryIndex, setCategoryIndex] = useState(); + const [newShelf, setnewSelf] = useState({ + name: '', + words: [], + revisedWords: [], + description: '', + viewPermission: 'PRIVATE' + }); + return
@@ -15,8 +26,18 @@ export const AddShelf: React.FC = () => {
- - + { + setnewSelf({ + ...newShelf, + name: event.currentTarget.value, + }); + } } /> +
@@ -28,8 +49,10 @@ export const AddShelf: React.FC = () => {
    - { userProfileData.categories.map(category => { - return
  • + { userProfileData.categories.map((category, index) => { + return
  • setCategoryIndex(index)} + className={index === selectedCategoryIndex ? '' : styles.inactive}> + { index === selectedCategoryIndex && }
    { category.icon }
    @@ -44,12 +67,24 @@ export const AddShelf: React.FC = () => {
    -
    +
    { + setnewSelf({ + ...newShelf, + viewPermission: newShelf.viewPermission === 'PRIVATE' ? 'PUBLIC' : 'PRIVATE', + }); + } }>
    - +
} \ No newline at end of file diff --git a/src/components/home/Home.tsx b/src/components/home/Home.tsx index 98551d6..d830c02 100644 --- a/src/components/home/Home.tsx +++ b/src/components/home/Home.tsx @@ -190,9 +190,9 @@ export const Home: React.FC = () => { Categories - + @@ -208,7 +208,7 @@ export const Home: React.FC = () => { { category.shelves.length } Shelves - })} + })}