diff --git a/src/components/scrollingmenu/ScrollingMenu.tsx b/src/components/scrollingmenu/ScrollingMenu.tsx index 59d3113..115892c 100644 --- a/src/components/scrollingmenu/ScrollingMenu.tsx +++ b/src/components/scrollingmenu/ScrollingMenu.tsx @@ -1,9 +1,10 @@ -import React from 'react'; +import React, { useRef } from 'react'; import path from 'path'; import settings from 'electron-settings'; import styled from 'styled-components'; +import { ButtonGroup, ButtonToolbar, FlexboxGrid, Icon } from 'rsuite'; import Card from '../card/Card'; -import { SectionTitleWrapper, SectionTitle } from '../shared/styled'; +import { SectionTitleWrapper, SectionTitle, StyledIconButton } from '../shared/styled'; import { getImageCachePath } from '../../shared/utils'; const ScrollMenuContainer = styled.div` @@ -14,19 +15,56 @@ const ScrollMenuContainer = styled.div` ::-webkit-scrollbar { height: 10px; } + + scroll-behavior: smooth; `; const ScrollingMenu = ({ cardTitle, cardSubtitle, data, title, onClickTitle, type }: any) => { const cacheImages = Boolean(settings.getSync('cacheImages')); const cachePath = path.join(getImageCachePath(), '/'); + const scrollContainerRef = useRef(); + const gridCardSize = Number(settings.getSync('gridCardSize')); return ( <> - {title} + + + { + console.log(e); + if (e.key === ' ' || e.key === 'Enter') { + onClickTitle(); + } + }} + > + {title} + + + + + + } + onClick={() => { + scrollContainerRef.current.scrollLeft -= gridCardSize * 5; + }} + /> + } + onClick={() => { + scrollContainerRef.current.scrollLeft += gridCardSize * 5; + }} + /> + + + + - + {data.map((item: any) => (