Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: UI upgrade #1111

Merged
merged 2 commits into from
Jun 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import * as React from "react";
import { useDispatch, useSelector } from "react-redux";
import Container from "@material-ui/core/Container";
import { ApplicationState } from "../../../Store/Configuration";
import { Navigation, Footer } from "../../../Components/Layout";
import { DocumentContent } from "../../../Components/Document";
import { DocumentContentWrapper } from "../../../Shared/Components";

import {
ContentNavigationAction,
Expand All @@ -30,9 +29,7 @@ export const AboutPage = (): JSX.Element => {
return (
<>
<Navigation />
<Container>
<DocumentContent isLoading={isLoading} items={items} />
</Container>
<DocumentContentWrapper isLoading={isLoading} items={items} />
<Footer />
</>
);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import * as React from "react";
import { useDispatch, useSelector } from "react-redux";
import Container from "@material-ui/core/Container";
import { ApplicationState } from "../../../Store/Configuration";
import { Navigation, Footer } from "../../../Components/Layout";
import { DocumentContent } from "../../../Components/Document";
import { DocumentContentWrapper } from "../../../Shared/Components";

import {
ContentNavigationAction,
Expand All @@ -30,9 +29,7 @@ export const BicyclePage = (): JSX.Element => {
return (
<>
<Navigation />
<Container>
<DocumentContent isLoading={isLoading} items={items} />
</Container>
<DocumentContentWrapper isLoading={isLoading} items={items} />
<Footer />
</>
);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import * as React from "react";
import { useDispatch, useSelector } from "react-redux";
import Container from "@material-ui/core/Container";
import { ApplicationState } from "../../../Store/Configuration";
import { Navigation, Footer } from "../../../Components/Layout";
import { DocumentContent } from "../../../Components/Document";
import { DocumentContentWrapper } from "../../../Shared/Components";

import {
ContentNavigationAction,
Expand All @@ -30,9 +29,7 @@ export const ElectronicsPage = (): JSX.Element => {
return (
<>
<Navigation />
<Container>
<DocumentContent isLoading={isLoading} items={items} />
</Container>
<DocumentContentWrapper isLoading={isLoading} items={items} />
<Footer />
</>
);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import * as React from "react";
import { useDispatch, useSelector } from "react-redux";
import Container from "@material-ui/core/Container";
import { ApplicationState } from "../../../Store/Configuration";
import { Navigation, Footer } from "../../../Components/Layout";
import { DocumentContent } from "../../../Components/Document";
import { DocumentContentWrapper } from "../../../Shared/Components";

import {
ContentNavigationAction,
Expand All @@ -30,9 +29,7 @@ export const FootballPage = (): JSX.Element => {
return (
<>
<Navigation />
<Container>
<DocumentContent isLoading={isLoading} items={items} />
</Container>
<DocumentContentWrapper isLoading={isLoading} items={items} />
<Footer />
</>
);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import * as React from "react";
import { useDispatch, useSelector } from "react-redux";
import Container from "@material-ui/core/Container";
import { ApplicationState } from "../../../Store/Configuration";
import { Navigation, Footer } from "../../../Components/Layout";
import { DocumentContent } from "../../../Components/Document";
import { DocumentContentWrapper } from "../../../Shared/Components";

import {
ContentNavigationAction,
Expand All @@ -30,9 +29,7 @@ export const GuitarPage = (): JSX.Element => {
return (
<>
<Navigation />
<Container>
<DocumentContent isLoading={isLoading} items={items} />
</Container>
<DocumentContentWrapper isLoading={isLoading} items={items} />
<Footer />
</>
);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import * as React from "react";
import { useDispatch, useSelector } from "react-redux";
import Container from "@material-ui/core/Container";
import { ApplicationState } from "../../../../Store/Configuration";
import { Navigation, Footer } from "../../../../Components/Layout";
import { DocumentContent } from "../../../../Components/Document";
import { DocumentContentWrapper } from "../../../../Shared/Components";

import {
ContentNavigationAction,
Expand All @@ -30,9 +29,7 @@ export const PolicyPage = (): JSX.Element => {
return (
<>
<Navigation />
<Container>
<DocumentContent isLoading={isLoading} items={items} />
</Container>
<DocumentContentWrapper isLoading={isLoading} items={items} />
<Footer />
</>
);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import * as React from "react";
import { useDispatch, useSelector } from "react-redux";
import Container from "@material-ui/core/Container";
import { ApplicationState } from "../../../../Store/Configuration";
import { Navigation, Footer } from "../../../../Components/Layout";
import { DocumentContent } from "../../../../Components/Document";
import { DocumentContentWrapper } from "../../../../Shared/Components";

import {
ContentNavigationAction,
Expand All @@ -30,9 +29,7 @@ export const TermsPage = (): JSX.Element => {
return (
<>
<Navigation />
<Container>
<DocumentContent isLoading={isLoading} items={items} />
</Container>
<DocumentContentWrapper isLoading={isLoading} items={items} />
<Footer />
</>
);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import * as React from "react";
import { useDispatch, useSelector } from "react-redux";
import Container from "@material-ui/core/Container";
import { ApplicationState } from "../../../Store/Configuration";
import { Navigation, Footer } from "../../../Components/Layout";
import { DocumentContent } from "../../../Components/Document";
import { DocumentContentWrapper } from "../../../Shared/Components";

import {
ContentNavigationAction,
Expand All @@ -30,9 +29,7 @@ export const PhotographyPage = (): JSX.Element => {
return (
<>
<Navigation />
<Container>
<DocumentContent isLoading={isLoading} items={items} />
</Container>
<DocumentContentWrapper isLoading={isLoading} items={items} />
<Footer />
</>
);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import * as React from "react";
import { useDispatch, useSelector } from "react-redux";
import Container from "@material-ui/core/Container";
import { ApplicationState } from "../../../Store/Configuration";
import { Navigation, Footer } from "../../../Components/Layout";
import { DocumentContent } from "../../../Components/Document";
import { DocumentContentWrapper } from "../../../Shared/Components";

import {
ContentNavigationAction,
Expand All @@ -30,9 +29,7 @@ export const ShowcasePage = (): JSX.Element => {
return (
<>
<Navigation />
<Container>
<DocumentContent isLoading={isLoading} items={items} />
</Container>
<DocumentContentWrapper isLoading={isLoading} items={items} />
<Footer />
</>
);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import * as React from "react";
import { useDispatch, useSelector } from "react-redux";
import Container from "@material-ui/core/Container";
import { ApplicationState } from "../../../Store/Configuration";
import { Navigation, Footer } from "../../../Components/Layout";
import { DocumentContent } from "../../../Components/Document";
import { DocumentContentWrapper } from "../../../Shared/Components";

import {
ContentNavigationAction,
Expand All @@ -30,9 +29,7 @@ export const StoryPage = (): JSX.Element => {
return (
<>
<Navigation />
<Container>
<DocumentContent isLoading={isLoading} items={items} />
</Container>
<DocumentContentWrapper isLoading={isLoading} items={items} />
<Footer />
</>
);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import * as React from "react";
import { Container } from "@material-ui/core";
import { ProgressOnScroll } from "../Scroll";
import { DocumentContent } from "../../../Components/Document";
import { Colours } from "../../../Theme";
import { TextItemDto } from "../../../Api/Models";

interface DocumentContentWrapperProps {
isLoading: boolean;
items: TextItemDto[];
}

export const DocumentContentWrapper = (props: DocumentContentWrapperProps): JSX.Element => {
return (
<>
<ProgressOnScroll height={3} bgcolor={Colours.application.navigation} duration={0.1} />
<Container>
<DocumentContent isLoading={props.isLoading} items={props.items} />
</Container>
</>
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,67 +5,75 @@ import { RenderTextStyle } from "./renderTextStyle";
import { ReactHtmlParser } from "../../../../../Shared/Services/Renderers";
import "../../../../../Theme/Css/customDropCap.css";

export const RenderText = (props: TextItem): JSX.Element => {
interface DataProps {
data: string
}

const RenderTitle = (props: DataProps): JSX.Element => {
const classes = RenderTextStyle();
const data: string = props.value as string;
return (
<Box mt={7} mb={0}>
<Typography variant="body1" component="span" className={`${classes.common} ${classes.title}`}>
<ReactHtmlParser html={props.data} />
</Typography>
</Box>
);
};

const renderTitle = (): JSX.Element => {
return (
<Box mt={7}>
<Typography variant="body1" component="span" className={`${classes.common} ${classes.title}`}>
<ReactHtmlParser html={data} />
</Typography>
</Box>
);
};
const RenderSubtitle = (props: DataProps): JSX.Element => {
const classes = RenderTextStyle();
return (
<Box mt={1} mb={5}>
<Typography variant="body1" component="span" className={`${classes.common} ${classes.subTitle}`}>
<ReactHtmlParser html={props.data} />
</Typography>
</Box>
);
};

const renderSubtitle = (): JSX.Element => {
return (
<Box mt={-1} mb={7}>
<Typography variant="body1" component="span" className={`${classes.common} ${classes.subTitle}`}>
<ReactHtmlParser html={data} />
</Typography>
</Box>
);
};
const RenderHeader = (props: DataProps): JSX.Element => {
const classes = RenderTextStyle();
return (
<Box mt={7} mb={2}>
<Typography variant="body1" component="span" className={`${classes.common} ${classes.header}`}>
<ReactHtmlParser html={props.data} />
</Typography>
</Box>
);
};

const renderHeader = (): JSX.Element => {
return (
<Box mt={7} mb={2}>
<Typography variant="body1" component="span" className={`${classes.common} ${classes.header}`}>
<ReactHtmlParser html={data} />
</Typography>
</Box>
);
};
const RenderParagraph = (props: DataProps): JSX.Element => {
const classes = RenderTextStyle();
return (
<Typography variant="body1" component="span" className={`${classes.common} ${classes.paragraph}`}>
<ReactHtmlParser html={props.data} />
</Typography>
);
};

const renderParagraph = (): JSX.Element => {
return (
<Typography variant="body1" component="span" className={`${classes.common} ${classes.paragraph}`}>
<ReactHtmlParser html={data} />
</Typography>
);
};
const RenderParagraphWithDropCap = (props: DataProps): JSX.Element => {
const classes = RenderTextStyle();
const replaced = props.data.replace("<p>", "<p class='custom-drop-cap'>");
return (
<Typography variant="body1" component="span" className={`${classes.common} ${classes.paragraph}`}>
<ReactHtmlParser html={replaced} />
</Typography>
);
};

const renderParagraphWithDropCap = (): JSX.Element => {
const replaced = data.replace("<p>", "<p class='custom-drop-cap'>");
return (
<Typography variant="body1" component="span" className={`${classes.common} ${classes.paragraph}`}>
<ReactHtmlParser html={replaced} />
</Typography>
);
};
export const RenderText = (props: TextItem): JSX.Element => {
const data: string = props.value as string;

switch (props.prop) {
case "title":
return renderTitle();
return <RenderTitle data={data} />;
case "subtitle":
return renderSubtitle();
return <RenderSubtitle data={data} />;
case "header":
return renderHeader();
return <RenderHeader data={data} />;
case "dropcap":
return renderParagraphWithDropCap();
return <RenderParagraphWithDropCap data={data} />;
default:
return renderParagraph();
return <RenderParagraph data={data} />;
}
};
1 change: 1 addition & 0 deletions TokanPages.ClientApp/src/Shared/Components/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
export { ApplicationDialogBox } from "./ApplicationDialogBox/applicationDialogBox";
export { ApplicationUserInfo } from "./ApplicationUserInfo/applicationUserInfo";
export { DocumentContentWrapper } from "./DocumentContentWrapper";
export { RenderContent } from "./RenderContent/renderContent";
export { RenderCardMedia } from "./CustomCardMedia/customCardMedia";
export { RenderImage } from "./CustomImage/customImage";
Expand Down
Loading