From 820b7913c280bab0dd37888aade0231a8fd24a48 Mon Sep 17 00:00:00 2001 From: prabhuignoto Date: Wed, 31 Jan 2024 16:54:40 +0530 Subject: [PATCH] incorporting the new toolbar --- src/components/list/list.styles.ts | 16 ++- src/components/list/list.tsx | 4 +- src/components/popover/index.tsx | 1 - src/components/popover/popover.styles.ts | 7 ++ src/components/timeline/timeline-toolbar.tsx | 107 +++++++++++++++++++ src/components/timeline/timeline.tsx | 31 ++++-- 6 files changed, 151 insertions(+), 15 deletions(-) create mode 100644 src/components/timeline/timeline-toolbar.tsx diff --git a/src/components/list/list.styles.ts b/src/components/list/list.styles.ts index 6849cb9f..404dcd83 100644 --- a/src/components/list/list.styles.ts +++ b/src/components/list/list.styles.ts @@ -7,18 +7,23 @@ export const ListStyle = styled.ul` display: flex; flex-direction: column; align-items: center; + min-width: 300px; `; export const ListItemStyle = styled.li` margin: 0; - padding: 1rem; + padding: 0.25rem; display: flex; flex-direction: column; align-items: center; margin-bottom: 1rem; + width: 100%; &:last-child { margin-bottom: 0; } + border-radius: 4px; + background: #f5f5f5; + box-shadow: 0px 1px 1px rgba(0, 0, 0, 0.1); &:hover { cursor: pointer; @@ -26,6 +31,11 @@ export const ListItemStyle = styled.li` } `; -export const TitleStyle = styled.h1``; +export const TitleStyle = styled.h1` + margin: 0.2rem 0; +`; -export const TitleDescriptionStyle = styled.p``; +export const TitleDescriptionStyle = styled.p` + padding: 0.1rem; + margin: 0; +`; diff --git a/src/components/list/list.tsx b/src/components/list/list.tsx index 2ea979ea..150c457b 100644 --- a/src/components/list/list.tsx +++ b/src/components/list/list.tsx @@ -20,8 +20,8 @@ const ListItem: FunctionComponent = ({ }) => { return ( - - + {title} + {description} ); }; diff --git a/src/components/popover/index.tsx b/src/components/popover/index.tsx index 42f9c593..30ba4ab7 100644 --- a/src/components/popover/index.tsx +++ b/src/components/popover/index.tsx @@ -22,7 +22,6 @@ const PopOver: FunctionComponent = ({ placeholder, }) => { const [open, setOpen] = useState(false); - const toggleOpen = () => setOpen(!open); return ( diff --git a/src/components/popover/popover.styles.ts b/src/components/popover/popover.styles.ts index 03950ec3..e8234f56 100644 --- a/src/components/popover/popover.styles.ts +++ b/src/components/popover/popover.styles.ts @@ -6,6 +6,13 @@ export const PopoverWrapper = styled.div``; export const PopoverHolder = styled.div<{ position: PopoverPosition }>` position: absolute; z-index: 100; + background: rgba(255, 255, 255, 1); + padding: 0.5rem; + box-shadow: 0px 5px 16px rgba(0, 0, 0, 0.2); + border-radius: 6px; + top: 3rem; + max-height: 300px; + overflow-y: auto; `; export const Selecter = styled.div` diff --git a/src/components/timeline/timeline-toolbar.tsx b/src/components/timeline/timeline-toolbar.tsx new file mode 100644 index 00000000..5a7b4670 --- /dev/null +++ b/src/components/timeline/timeline-toolbar.tsx @@ -0,0 +1,107 @@ +import { TimelineModel, TimelineProps } from '@models/TimelineModel'; +import { FunctionComponent } from 'react'; +import { List } from '../list/list'; +import { PopOver } from '../popover'; +import TimelineControl from '../timeline-elements/timeline-control/timeline-control'; +import { Toolbar } from '../toolbar'; + +export type TimelineToolbarProps = Pick< + TimelineModel, + | 'activeTimelineItem' + | 'slideShowEnabled' + | 'slideShowRunning' + | 'onRestartSlideshow' + | 'onNext' + | 'onPrevious' + | 'onPaused' + | 'onFirst' + | 'onLast' +> & { + toggleDarkMode: () => void; + totalItems: number; + id: string; +} & Pick; + +const TimelineToolbar: FunctionComponent = ({ + activeTimelineItem, + slideShowEnabled, + slideShowRunning, + darkMode, + flipLayout, + toggleDarkMode, + onPaused, + onFirst, + onLast, + onNext, + onPrevious, + onRestartSlideshow, + totalItems, + id, +}) => { + return ( + + ), + onSelect: () => {}, + }, + { + name: 'popover', + label: 'timeline_popover', + content: ( + + + + ), + onSelect: () => {}, + }, + ]} + /> + ); +}; + +export { TimelineToolbar }; diff --git a/src/components/timeline/timeline.tsx b/src/components/timeline/timeline.tsx index 24f081cb..014c04c7 100644 --- a/src/components/timeline/timeline.tsx +++ b/src/components/timeline/timeline.tsx @@ -14,12 +14,9 @@ import React, { import { GlobalContext } from '../GlobalContext'; import { useMatchMedia } from '../effects/useMatchMedia'; import useNewScrollPosition from '../effects/useNewScrollPosition'; -import { List } from '../list/list'; -import { PopOver } from '../popover'; -import TimelineControl from '../timeline-elements/timeline-control/timeline-control'; import TimelineHorizontal from '../timeline-horizontal/timeline-horizontal'; import TimelineVertical from '../timeline-vertical/timeline-vertical'; -import { Toolbar } from '../toolbar'; +import { TimelineToolbar } from './timeline-toolbar'; import { Outline, TimelineContentRender, @@ -364,11 +361,11 @@ const Timeline: React.FunctionComponent = ( }} > - = ( onSelect: () => {}, }, { - name: 'test', - label: 'test', + name: 'popover', + label: 'timeline_popover', content: ( = ( onSelect: () => {}, }, ]} + /> */} +