From 8e39d53addddf61b36afc028728effbbeef259bb Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Wed, 19 Feb 2020 13:35:04 +0100 Subject: [PATCH] added 3 column layout to footer --- .../src/layout/Footer.stories.tsx | 2 + scm-ui/ui-components/src/layout/Footer.tsx | 113 +++++++++++------- .../src/layout/FooterSection.tsx | 30 +++++ scm-ui/ui-styles/src/scm.scss | 2 +- 4 files changed, 106 insertions(+), 41 deletions(-) create mode 100644 scm-ui/ui-components/src/layout/FooterSection.tsx diff --git a/scm-ui/ui-components/src/layout/Footer.stories.tsx b/scm-ui/ui-components/src/layout/Footer.stories.tsx index a4f85bc4ef..35a277ab61 100644 --- a/scm-ui/ui-components/src/layout/Footer.stories.tsx +++ b/scm-ui/ui-components/src/layout/Footer.stories.tsx @@ -6,6 +6,7 @@ import { Me } from "@scm-manager/ui-types"; import { EXTENSION_POINT } from "../avatar/Avatar"; // @ts-ignore ignore unknown png import avatar from "../__resources__/avatar.png"; +import NavLink from "../navigation/NavLink"; const trillian: Me = { name: "trillian", @@ -24,6 +25,7 @@ const bindAvatar = (binder: Binder) => { const bindLinks = (binder: Binder) => { binder.bind("footer.links", () => REST API); binder.bind("footer.links", () => CLI); + binder.bind("profile.setting", () => ); }; const withBinder = (binder: Binder) => { diff --git a/scm-ui/ui-components/src/layout/Footer.tsx b/scm-ui/ui-components/src/layout/Footer.tsx index 3243134353..35916a7f52 100644 --- a/scm-ui/ui-components/src/layout/Footer.tsx +++ b/scm-ui/ui-components/src/layout/Footer.tsx @@ -1,8 +1,11 @@ import React, { FC } from "react"; import { Me, Links } from "@scm-manager/ui-types"; -import { Link } from "react-router-dom"; -import { useBinder } from "@scm-manager/ui-extensions"; -import { AvatarWrapper, AvatarImage } from "../avatar"; +import { useBinder, ExtensionPoint } from "@scm-manager/ui-extensions"; +import { AvatarImage } from "../avatar"; +import NavLink from "../navigation/NavLink"; +import FooterSection from "./FooterSection"; +import styled from "styled-components"; +import { EXTENSION_POINT } from "../avatar/Avatar"; type Props = { me?: Me; @@ -10,51 +13,81 @@ type Props = { links: Links; }; +type TitleWithIconsProps = { + title: string; + icon: string; +}; + +const TitleWithIcon: FC = ({ icon, title }) => ( + <> + {title} + +); + +type TitleWithAvatarProps = { + me: Me; +}; + +const VCenteredAvatar = styled(AvatarImage)` + vertical-align: middle; +`; + +const AvatarContainer = styled.span` + float: left; + margin-right: 0.3em; + padding-top: 0.2em; + width: 1em; + height: 1em; +`; + +const TitleWithAvatar: FC = ({ me }) => ( + <> + + + + {me.displayName} + +); + const Footer: FC = ({ me, version, links }) => { const binder = useBinder(); if (!me) { return null; } - const extensionProps = { me, links }; - const extensions = binder.getExtensions("footer.links", extensionProps); + const extensionProps = { me, url: "/me", links }; + let meSectionTile; + if (binder.hasExtension(EXTENSION_POINT)) { + meSectionTile = ; + } else { + meSectionTile = ; + } return ( ); }; diff --git a/scm-ui/ui-components/src/layout/FooterSection.tsx b/scm-ui/ui-components/src/layout/FooterSection.tsx new file mode 100644 index 0000000000..8f94499ff7 --- /dev/null +++ b/scm-ui/ui-components/src/layout/FooterSection.tsx @@ -0,0 +1,30 @@ +import React, { FC, ReactNode } from "react"; +import styled from "styled-components"; + +type Props = { + title: ReactNode; +}; + +const Title = styled.div` + font-weight: bold; + margin-bottom: 0.5rem; +`; + +const Menu = styled.ul` + padding-left: 1.1rem; +`; + +const FooterSection: FC = ({ title, children }) => { + return ( +
+ {title} + + {React.Children.map(children, (child, index) => ( +
  • {child}
  • + ))} +
    +
    + ); +}; + +export default FooterSection; diff --git a/scm-ui/ui-styles/src/scm.scss b/scm-ui/ui-styles/src/scm.scss index dffa4cb00e..e4e489f880 100644 --- a/scm-ui/ui-styles/src/scm.scss +++ b/scm-ui/ui-styles/src/scm.scss @@ -70,7 +70,7 @@ hr.header-with-actions { footer.footer { //height: 100px; background-color: whitesmoke; - padding: 2rem 1.5rem 1rem; + padding: inherit; } // 6. Import the rest of Bulma