From 843b5520e85ef6f9feb3c2881da9f8f119b6c036 Mon Sep 17 00:00:00 2001 From: vidhya-metacell Date: Fri, 22 Jul 2022 19:15:45 +0200 Subject: [PATCH] #16 Sidebar selected state for optionns availble in list --- src/components/Sidebar.tsx | 77 ++++++++++--------- src/components/assets/svg/cursor-active.svg | 3 + src/components/assets/svg/cursor.svg | 2 +- .../assets/svg/fullscreen-active.svg | 3 + src/components/assets/svg/fullscreen.svg | 2 +- src/components/assets/svg/icon-active.svg | 3 + src/components/assets/svg/icon.svg | 2 +- src/components/assets/svg/move-active.svg | 3 + src/components/assets/svg/node.svg | 13 ++-- 9 files changed, 63 insertions(+), 45 deletions(-) create mode 100644 src/components/assets/svg/cursor-active.svg create mode 100644 src/components/assets/svg/fullscreen-active.svg create mode 100644 src/components/assets/svg/icon-active.svg create mode 100644 src/components/assets/svg/move-active.svg diff --git a/src/components/Sidebar.tsx b/src/components/Sidebar.tsx index 94d567a..b0f83f6 100644 --- a/src/components/Sidebar.tsx +++ b/src/components/Sidebar.tsx @@ -4,36 +4,18 @@ import { makeStyles } from '@mui/styles'; import vars from './assets/styles/variables'; import { Divider, List, ListItemButton, ListItemIcon } from '@mui/material'; import Move from './assets/svg/move.svg'; +import MoveActive from './assets/svg/move-active.svg'; import Icon from './assets/svg/icon.svg'; +import IconActive from './assets/svg/icon-active.svg'; import Node from './assets/svg/node.svg'; import Cursor from './assets/svg/cursor.svg'; +import CursorActive from './assets/svg/cursor-active.svg'; import Fullscreen from './assets/svg/fullscreen.svg'; +import FullscreenActive from './assets/svg/fullscreen-active.svg'; -const { textWhite, dividerColor } = vars; +const { dividerColor } = vars; const useStyles = makeStyles(() => ({ - root: { - zIndex: '5', - width: '4rem', - background: textWhite, - boxShadow: - '0 0 3.75rem rgba(0, 0, 0, 0.1), 0 0.5rem 2.5rem -0.625rem rgba(0, 0, 0, 0.1)', - borderRadius: '2rem', - position: 'fixed', - left: '1rem', - top: '50%', - transform: 'translateY(-50%)', - - '&.right': { - left: 'auto', - right: '1rem', - }, - - '& .MuiList-root': { - padding: '0.75rem', - }, - }, - node: { margin: '0.25rem 0', '& .MuiDivider-root': { @@ -53,28 +35,41 @@ const useStyles = makeStyles(() => ({ const Sidebar = () => { const classes = useStyles(); + const [selected, setSelected] = React.useState("1"); + return ( - + - + setSelected("1")}> - icon : icon + />} - + setSelected("2")}> - move : move + />} + @@ -91,25 +86,35 @@ const Sidebar = () => { - + setSelected("3")}> - icon : icon + />} - + setSelected("4")}> - fullscreen : fullscreen + />} diff --git a/src/components/assets/svg/cursor-active.svg b/src/components/assets/svg/cursor-active.svg new file mode 100644 index 0000000..c3104dd --- /dev/null +++ b/src/components/assets/svg/cursor-active.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/components/assets/svg/cursor.svg b/src/components/assets/svg/cursor.svg index c3104dd..6a35fe4 100644 --- a/src/components/assets/svg/cursor.svg +++ b/src/components/assets/svg/cursor.svg @@ -1,3 +1,3 @@ - + diff --git a/src/components/assets/svg/fullscreen-active.svg b/src/components/assets/svg/fullscreen-active.svg new file mode 100644 index 0000000..34ab854 --- /dev/null +++ b/src/components/assets/svg/fullscreen-active.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/components/assets/svg/fullscreen.svg b/src/components/assets/svg/fullscreen.svg index 9b790ad..223507d 100644 --- a/src/components/assets/svg/fullscreen.svg +++ b/src/components/assets/svg/fullscreen.svg @@ -1,3 +1,3 @@ - + diff --git a/src/components/assets/svg/icon-active.svg b/src/components/assets/svg/icon-active.svg new file mode 100644 index 0000000..4fa3bcb --- /dev/null +++ b/src/components/assets/svg/icon-active.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/components/assets/svg/icon.svg b/src/components/assets/svg/icon.svg index 50503cd..29ded5d 100644 --- a/src/components/assets/svg/icon.svg +++ b/src/components/assets/svg/icon.svg @@ -1,3 +1,3 @@ - + diff --git a/src/components/assets/svg/move-active.svg b/src/components/assets/svg/move-active.svg new file mode 100644 index 0000000..5eaf279 --- /dev/null +++ b/src/components/assets/svg/move-active.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/components/assets/svg/node.svg b/src/components/assets/svg/node.svg index 208e7e4..e978ea0 100644 --- a/src/components/assets/svg/node.svg +++ b/src/components/assets/svg/node.svg @@ -1,19 +1,20 @@ - + + - + - + - + - - + +