From 254d885c7722235c56b2bea8f515c489eaaac925 Mon Sep 17 00:00:00 2001 From: "ildar.timerbaev" Date: Thu, 7 Dec 2023 11:41:29 +0600 Subject: [PATCH 1/2] Fixed styling issues --- .../deck-items/deck-search-list-item.tsx | 10 ++++++---- .../components/introduction/_index.scss | 19 +------------------ .../components/search-communities/index.tsx | 4 ++-- src/common/components/search-people/index.tsx | 4 ++-- src/common/components/search-topics/index.tsx | 4 ++-- .../ui/accordion/accordion-toggle.tsx | 7 +++++-- 6 files changed, 18 insertions(+), 30 deletions(-) diff --git a/src/common/components/decks/columns/deck-items/deck-search-list-item.tsx b/src/common/components/decks/columns/deck-items/deck-search-list-item.tsx index 7c3b017a8bb..778952bbabf 100644 --- a/src/common/components/decks/columns/deck-items/deck-search-list-item.tsx +++ b/src/common/components/decks/columns/deck-items/deck-search-list-item.tsx @@ -178,7 +178,7 @@ export const SearchListItem = ({
-
+
{author && ( onEntryView()} className="pointer"> {title && (
-
{title}
+
{title}
)} @@ -237,7 +237,9 @@ export const SearchListItem = ({ }} /> )} -
{body}
+
+ {body} +
@@ -251,7 +253,7 @@ export const SearchListItem = ({ /> - +
{commentSvg}
{entry.children}
diff --git a/src/common/components/introduction/_index.scss b/src/common/components/introduction/_index.scss index d6a6c699790..2c43a552cdd 100644 --- a/src/common/components/introduction/_index.scss +++ b/src/common/components/introduction/_index.scss @@ -12,7 +12,7 @@ height: 55vh; width: 55vw; @apply bg-white; - @include themify(night){ + @include themify(night) { @apply bg-dark-default; } left: 50%; @@ -60,23 +60,6 @@ top: -70px; margin-left: 5%; transform: rotateZ(-15deg); - - @media screen and (max-width: $sm-break) { - border-left: 0px solid transparent; - border-right: 30px solid transparent; - border-bottom: 40px solid; - @apply border-white; - @include themify(night) { - @apply border-b-dark-default; - } - content: ""; - position: absolute; - top: -32px; - margin-left: 0%; - -webkit-transform: rotateZ(-15deg); - transform: rotateZ(11deg); - - } } .paragraph { diff --git a/src/common/components/search-communities/index.tsx b/src/common/components/search-communities/index.tsx index d1e3a6107ea..f75669650a3 100644 --- a/src/common/components/search-communities/index.tsx +++ b/src/common/components/search-communities/index.tsx @@ -82,8 +82,8 @@ export class SearchCommunities extends BaseComponent { const { loading, results } = this.state; return ( -
-
+
+
{_t("search-communities.title")}
diff --git a/src/common/components/search-people/index.tsx b/src/common/components/search-people/index.tsx index 7fcb77530d6..28d39a323e7 100644 --- a/src/common/components/search-people/index.tsx +++ b/src/common/components/search-people/index.tsx @@ -75,8 +75,8 @@ export class SearchPeople extends BaseComponent { const { loading, results } = this.state; return ( -
-
+
+
{_t("search-people.title")}
diff --git a/src/common/components/search-topics/index.tsx b/src/common/components/search-topics/index.tsx index 5df4b7bd48e..ecaaad2d9f7 100644 --- a/src/common/components/search-topics/index.tsx +++ b/src/common/components/search-topics/index.tsx @@ -72,8 +72,8 @@ export class SearchTopics extends BaseComponent { const { results, loading } = this.state; return ( -
-
+
+
{_t("search-topics.title")}
diff --git a/src/common/features/ui/accordion/accordion-toggle.tsx b/src/common/features/ui/accordion/accordion-toggle.tsx index 70c5d304d22..75faf52c0df 100644 --- a/src/common/features/ui/accordion/accordion-toggle.tsx +++ b/src/common/features/ui/accordion/accordion-toggle.tsx @@ -5,6 +5,7 @@ import { useFilteredProps } from "../../../util/props-filter"; interface Props extends PropsWithChildren { as?: any; eventKey: string; + onClick?: () => void; } export function AccordionToggle(props: Props) { @@ -15,11 +16,13 @@ export function AccordionToggle(props: Props) { props.as ?? "div", { ...nativeProps, - onClick: () => + onClick: () => { setShow({ ...show, [props.eventKey]: !show[props.eventKey] ?? false - }) + }); + props.onClick?.(); + } }, props.children ); From e772d15d19b3a02e5cecf2b254394fd013d87ac2 Mon Sep 17 00:00:00 2001 From: "ildar.timerbaev" Date: Thu, 7 Dec 2023 12:55:09 +0600 Subject: [PATCH 2/2] Decks: added arrows for scrolling --- src/common/components/decks/deck-grid.tsx | 43 ++++++++++++++++++++++- 1 file changed, 42 insertions(+), 1 deletion(-) diff --git a/src/common/components/decks/deck-grid.tsx b/src/common/components/decks/deck-grid.tsx index 7403570ba1a..b68aaa1d970 100644 --- a/src/common/components/decks/deck-grid.tsx +++ b/src/common/components/decks/deck-grid.tsx @@ -1,4 +1,4 @@ -import React, { useContext, useEffect, useState } from "react"; +import React, { useContext, useEffect, useMemo, useState } from "react"; import { DragDropContext, Draggable, Droppable, DropResult } from "react-beautiful-dnd"; import { DeckGridContext } from "./deck-manager"; import { DeckAddColumn, DeckUserColumn } from "./columns"; @@ -26,6 +26,7 @@ import { DeckFaqColumn } from "./columns/deck-faq-column"; import { DeckWalletBalanceColumn } from "./columns/deck-wallet-balance-column"; import { DeckWhatsNewColumn } from "./columns/deck-whats-new-column"; import { Button } from "@ui/button"; +import { arrowLeftSvg, arrowRightSvg } from "../../img/svg"; interface Props { history: History; @@ -35,9 +36,19 @@ export const DeckGrid = ({ history }: Props) => { const deckContext = useContext(DeckGridContext); const previousLayout = usePrevious(deckContext.layout); + const [scrollValue, setScrollValue] = useState(0); const [addColumnButtonVisible, setAddColumnButtonVisible] = useState(true); const [addColumnButtonKey, setAddColumnButtonKey] = useState(uuid.v4()); + const isScrollStarted = useMemo(() => scrollValue > 0, [scrollValue]); + const isScrollEnded = useMemo(() => { + const el = document.querySelector("#draggable-container"); + if (el) { + return Math.round(scrollValue) === Math.round(el.scrollWidth - el.clientWidth); + } + return false; + }, [scrollValue]); + useOldDeckMigration(); const onDragEnd = (result: DropResult) => { @@ -66,8 +77,37 @@ export const DeckGrid = ({ history }: Props) => { } }, [deckContext.layout]); + const scrollTo = (direction: "left" | "right") => { + const el = document.querySelector("#draggable-container"); + if (!el) { + return; + } + + if (direction === "left") { + el.scrollTo(el.scrollLeft - 300, 0); + } else { + el.scrollTo(el.scrollLeft + 300, 0); + } + }; + return (
+ {isScrollStarted && ( +
scrollTo("left")} + > + {arrowLeftSvg} +
+ )} + {!isScrollEnded && ( +
scrollTo("right")} + > + {arrowRightSvg} +
+ )} {(provided, snapshot) => ( @@ -76,6 +116,7 @@ export const DeckGrid = ({ history }: Props) => { ref={provided.innerRef} {...provided.droppableProps} id="draggable-container" + onScroll={(e) => setScrollValue(e.currentTarget.scrollLeft)} > {deckContext.layout.columns.map(({ type, id, settings, key }, index) => (