diff --git a/src/app/(main)/dashboard/DashboardEdit.module.css b/src/app/(main)/dashboard/DashboardEdit.module.css index 071dd6a4..19266d17 100644 --- a/src/app/(main)/dashboard/DashboardEdit.module.css +++ b/src/app/(main)/dashboard/DashboardEdit.module.css @@ -1,46 +1,34 @@ .buttons { display: flex; + align-items: center; justify-content: flex-end; gap: 10px; - margin-bottom: 20px; } .item { - padding: 5px 0; - position: relative; -} - -.pinActive { - position: absolute; - top: 10px; - right: 10px; - padding: 5px; -} - -.item h1 { - font-weight: 600; - font-size: 16px; -} - -.item h2 { - font-size: 14px; - color: var(--base700); -} - -.text { + display: flex; + align-items: center; + justify-content: space-between; + width: 100%; padding: 20px; border-radius: 5px; border: 1px solid var(--base400); background: var(--base50); + margin-bottom: 10px; } -.websiteActive .text { - border: 1px solid var(--base800); +.text { + position: relative; } -.active .text { - border-color: var(--base600); - box-shadow: 4px 4px 4px var(--base100); +.name { + font-weight: 600; + font-size: 16px; +} + +.domain { + font-size: 14px; + color: var(--base700); } .dragActive { @@ -50,3 +38,20 @@ .dragActive:active { cursor: grabbing; } + +.header { + display: flex; + align-items: center; + justify-content: space-between; + margin-bottom: 20px; + gap: 20px; +} + +.search { + max-width: 360px; +} + +.active { + border-color: var(--base600); + box-shadow: 4px 4px 4px var(--base100); +} diff --git a/src/app/(main)/dashboard/DashboardEdit.tsx b/src/app/(main)/dashboard/DashboardEdit.tsx index b599b840..42eb99ac 100644 --- a/src/app/(main)/dashboard/DashboardEdit.tsx +++ b/src/app/(main)/dashboard/DashboardEdit.tsx @@ -1,8 +1,7 @@ import { useState, useMemo, useEffect } from 'react'; import { DragDropContext, Draggable, Droppable } from 'react-beautiful-dnd'; import classNames from 'classnames'; -import { Button, Icon, Loading } from 'react-basics'; -import Icons from 'components/icons'; +import { Button, Loading, Toggle, SearchField } from 'react-basics'; import { firstBy } from 'thenby'; import useDashboard, { saveDashboard } from 'store/dashboard'; import { useMessages, useWebsites } from 'components/hooks'; @@ -18,6 +17,7 @@ export function DashboardEdit({ teamId }: { teamId: string }) { const [active, setActive] = useState(websiteActive || []); const [edited, setEdited] = useState(isEdited); const [websites, setWebsites] = useState([]); + const [search, setSearch] = useState(''); const { result, @@ -92,16 +92,19 @@ export function DashboardEdit({ teamId }: { teamId: string }) { return ( <> -
- - - +
+ +
+ + + +
@@ -112,33 +115,38 @@ export function DashboardEdit({ teamId }: { teamId: string }) { ref={provided.innerRef} style={{ marginBottom: snapshot.isDraggingOver ? 260 : null }} > - {ordered.map(({ id, name, domain }, index) => ( - - {(provided, snapshot) => ( -
-
-
- + {ordered.map(({ id, name, domain }, index) => { + if ( + search && + !`${name.toLowerCase()}${domain.toLowerCase()}`.includes(search.toLowerCase()) + ) { + return null; + } + + return ( + + {(provided, snapshot) => ( +
+
+
{name}
+
{domain}
-

{name}

-

{domain}

+ handleActiveWebsites(id)} + />
-
- )} - - ))} + )} + + ); + })} {provided.placeholder}
)}