From 995e700138ee51c388f00d2769c58c3974161c0a Mon Sep 17 00:00:00 2001 From: Alex Zoitos Date: Mon, 24 Aug 2020 08:02:59 -0400 Subject: [PATCH] refactor(layout component + sub components): refactor layout - extract sidebar, search etc (#11) Extract Sidebar, search, userDropdown, Notifications from Layout component --- src/components/Layout/Notifications/index.tsx | 26 ++ src/components/Layout/Sidebar/index.tsx | 132 ++++++++++ src/components/Layout/UserDropdown/index.tsx | 68 ++++++ src/components/Layout/index.tsx | 228 +----------------- src/components/Search/index.tsx | 32 +++ 5 files changed, 266 insertions(+), 220 deletions(-) create mode 100644 src/components/Layout/Notifications/index.tsx create mode 100644 src/components/Layout/Sidebar/index.tsx create mode 100644 src/components/Layout/UserDropdown/index.tsx create mode 100644 src/components/Search/index.tsx diff --git a/src/components/Layout/Notifications/index.tsx b/src/components/Layout/Notifications/index.tsx new file mode 100644 index 000000000..d30d5a070 --- /dev/null +++ b/src/components/Layout/Notifications/index.tsx @@ -0,0 +1,26 @@ +import React from 'react'; + +const Notifications: React.FC = () => { + return ( + + ); +}; + +export default Notifications; diff --git a/src/components/Layout/Sidebar/index.tsx b/src/components/Layout/Sidebar/index.tsx new file mode 100644 index 000000000..71763076f --- /dev/null +++ b/src/components/Layout/Sidebar/index.tsx @@ -0,0 +1,132 @@ +import React, { useState } from 'react'; +import Transition from '../../Transition'; + +interface SidebarProps { + open?: boolean; + setClosed: () => void; +} + +const Sidebar: React.FC = ({ open, setClosed }) => { + return ( + <> +
+ +
+ +
+
+
+
+ + <> +
+
+ +
+
+
+ + Overseerr + +
+ +
+
+
+ {/* */} +
+ +
+
+
+
+ +
+
+
+
+
+ Overseerr +
+ +
+
+
+
+ + ); +}; + +export default Sidebar; diff --git a/src/components/Layout/UserDropdown/index.tsx b/src/components/Layout/UserDropdown/index.tsx new file mode 100644 index 000000000..7c5a5f49f --- /dev/null +++ b/src/components/Layout/UserDropdown/index.tsx @@ -0,0 +1,68 @@ +import React, { useState } from 'react'; +import Transition from '../../Transition'; + +const UserDropdown: React.FC = () => { + const [isDropdownOpen, setDropdownOpen] = useState(false); + + return ( +
+
+ +
+ +
+ +
+
+
+ ); +}; + +export default UserDropdown; diff --git a/src/components/Layout/index.tsx b/src/components/Layout/index.tsx index 3f614adb5..ec6229c46 100644 --- a/src/components/Layout/index.tsx +++ b/src/components/Layout/index.tsx @@ -1,128 +1,16 @@ import React, { useState } from 'react'; -import Transition from '../Transition'; +import Search from '../Search'; +import UserDropdown from './UserDropdown'; +import Sidebar from './Sidebar'; +import Notifications from './Notifications'; const Layout: React.FC = ({ children }) => { const [isSidebarOpen, setSidebarOpen] = useState(false); - const [isDropdownOpen, setDropdownOpen] = useState(false); return (
-
- -
- -
-
-
-
- - <> -
-
- -
-
-
- - Overseerr - -
- -
-
-
- {/* */} -
- -
-
-
-
+ setSidebarOpen(false)} /> -
-
-
-
-
- Overseerr -
- -
-
-
-
-
-
- -
-
- - - -
- -
-
-
+
- -
-
- -
- - - -
+ +
diff --git a/src/components/Search/index.tsx b/src/components/Search/index.tsx new file mode 100644 index 000000000..b7017a936 --- /dev/null +++ b/src/components/Search/index.tsx @@ -0,0 +1,32 @@ +import React from 'react'; + +const Search: React.FC = () => { + return ( +
+
+ +
+
+ + + +
+ +
+
+
+ ); +}; + +export default Search;