From 9ecda1719cf8a2452d509a1c0aad94c0fd0e7f09 Mon Sep 17 00:00:00 2001 From: Maxime Lalo Date: Fri, 19 Jul 2024 13:13:01 +0200 Subject: [PATCH 1/2] :sparkles: clickable logo --- src/front/Components/DesignSystem/Header/classes.module.scss | 2 +- src/front/Components/DesignSystem/Header/index.tsx | 2 +- src/front/Components/Materials/Header/index.tsx | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/front/Components/DesignSystem/Header/classes.module.scss b/src/front/Components/DesignSystem/Header/classes.module.scss index 932272ab..bfcf4e6c 100644 --- a/src/front/Components/DesignSystem/Header/classes.module.scss +++ b/src/front/Components/DesignSystem/Header/classes.module.scss @@ -22,7 +22,7 @@ .logo-container { > a { - cursor: default !important; + cursor: pointer !important; } .logo { width: 174px; diff --git a/src/front/Components/DesignSystem/Header/index.tsx b/src/front/Components/DesignSystem/Header/index.tsx index b5d28053..e746dafb 100644 --- a/src/front/Components/DesignSystem/Header/index.tsx +++ b/src/front/Components/DesignSystem/Header/index.tsx @@ -72,7 +72,7 @@ class HeaderClass extends React.Component {
- + logo
diff --git a/src/front/Components/Materials/Header/index.tsx b/src/front/Components/Materials/Header/index.tsx index 8e0455d6..15d03b2f 100644 --- a/src/front/Components/Materials/Header/index.tsx +++ b/src/front/Components/Materials/Header/index.tsx @@ -5,6 +5,7 @@ import TezosLinkLogo from "@Assets/link_logo.svg"; import Logo from "@Assets/logo_standard_neutral.svg"; import classes from "./classes.module.scss"; import Burger from "@Front/Components/Elements/Burger"; +import Module from "@Front/Config/Module"; type IProps = {}; type IState = { @@ -33,7 +34,7 @@ export default class Header extends React.Component {
- + entire stack
From 7eb775d1e34121a2531fab9ffa8180660eb9d9ad Mon Sep 17 00:00:00 2001 From: Maxime Lalo Date: Fri, 19 Jul 2024 14:37:44 +0200 Subject: [PATCH 2/2] :sparkles: default double side page working --- .../DefaultDoubleSidePage/classes.module.scss | 26 +----- .../DefaultDoubleSidePage/index.tsx | 82 ++++++++++--------- 2 files changed, 47 insertions(+), 61 deletions(-) diff --git a/src/front/Components/LayoutTemplates/DefaultDoubleSidePage/classes.module.scss b/src/front/Components/LayoutTemplates/DefaultDoubleSidePage/classes.module.scss index 02a83d39..2b7fe333 100644 --- a/src/front/Components/LayoutTemplates/DefaultDoubleSidePage/classes.module.scss +++ b/src/front/Components/LayoutTemplates/DefaultDoubleSidePage/classes.module.scss @@ -1,31 +1,17 @@ @import "@Themes/constants.scss"; .root { - max-height: 100vh; - min-height: 100vh; - overflow: hidden; - .content { display: flex; - height: calc(100vh - 83px); - - .side-left { - max-height: 100vh; - overflow: auto; - } .sides { - width: 50%; - + min-height: calc(100vh - 83px); + flex: 1; @media (max-width: $screen-m) { width: 100%; } &.image-container { - display: flex; - align-items: center; - justify-content: center; - @media (max-width: $screen-m) { display: none; } @@ -34,23 +20,19 @@ .image { width: 100%; - height: 100%; object-fit: contain; } } &.background-image-container { - display: flex; - align-items: center; - justify-content: center; - + height: 0px; @media (max-width: $screen-m) { display: none; } .background-image { - height: 100%; width: 100%; + height: 100%; object-fit: cover; } } diff --git a/src/front/Components/LayoutTemplates/DefaultDoubleSidePage/index.tsx b/src/front/Components/LayoutTemplates/DefaultDoubleSidePage/index.tsx index 033d8643..e306a02b 100644 --- a/src/front/Components/LayoutTemplates/DefaultDoubleSidePage/index.tsx +++ b/src/front/Components/LayoutTemplates/DefaultDoubleSidePage/index.tsx @@ -2,7 +2,7 @@ import Header from "@Front/Components/DesignSystem/Header"; import Version from "@Front/Components/DesignSystem/Version"; import classNames from "classnames"; import Image, { StaticImageData } from "next/image"; -import React, { ReactNode } from "react"; +import React, { ReactNode, useEffect, useRef } from "react"; import classes from "./classes.module.scss"; @@ -12,47 +12,51 @@ type IProps = { /** * @description scroll top with number or disabled with null */ - scrollTop: number | null; + scrollTop?: number | null; image: StaticImageData; - type: "background" | "image"; - showHeader: boolean; + type?: "background" | "image"; + showHeader?: boolean; }; -type IState = {}; +export default function DefaultDoubleSidePage(props: IProps) { + const { title, children, scrollTop = 0, image, type = "background", showHeader = false } = props; -export default class DefaultDoubleSidePage extends React.Component { - public static defaultProps = { - scrollTop: 0, - type: "background", - showHeader: false, - }; - - public override render(): JSX.Element { - return ( -
-
-
-
{this.props.children}
- {this.props.type === "image" && ( -
- {"right -
- )} - {this.props.type === "background" && ( -
- {"right -
- )} -
- -
- ); - } - - public override componentDidMount() { - window.document.title = this.props.title; - if (this.props.scrollTop !== null) { - window.scrollTo(0, this.props.scrollTop); + useEffect(() => { + window.document.title = title; + if (scrollTop !== null) { + window.scrollTo(0, scrollTop); } - } + }, [scrollTop, title]); + + useEffect(() => { + // make second element ref height same as first element ref height + if (firstElementRef.current && secondElementRef.current) { + secondElementRef.current.style.height = `${firstElementRef.current.clientHeight}px`; + } + }, []); + + const firstElementRef = useRef(null); + const secondElementRef = useRef(null); + + return ( +
+
+
+
+ {children} +
+ {type === "image" && ( +
+ {"right +
+ )} + {type === "background" && ( +
+ {"right +
+ )} +
+ +
+ ); }