From 2e4e0f12f25a23ba760180ed5e27e88b6d56bfea Mon Sep 17 00:00:00 2001 From: mDuo13 Date: Tue, 9 Aug 2022 16:13:48 -0700 Subject: [PATCH] Override footer with XRPL style --- _components/LayoutWrapper.tsx | 2 +- _override/Footer.tsx | 134 ++++++++++++++++++++++++ docs/references/{index.md => index.mdx} | 0 siteConfig.yaml | 25 ++++- 4 files changed, 158 insertions(+), 3 deletions(-) create mode 100644 _override/Footer.tsx rename docs/references/{index.md => index.mdx} (100%) diff --git a/_components/LayoutWrapper.tsx b/_components/LayoutWrapper.tsx index 8525995..ed65db6 100644 --- a/_components/LayoutWrapper.tsx +++ b/_components/LayoutWrapper.tsx @@ -8,7 +8,7 @@ import navbar from '../top-nav.yaml'; export default function LayoutWrapper(props) { const topmargin = navbar.alertbanner.show ? {"marginTop": "126px"} : {"marginTop": "80px"}; return ( -
+
{props.children} {}
); diff --git a/_override/Footer.tsx b/_override/Footer.tsx new file mode 100644 index 0000000..b95a392 --- /dev/null +++ b/_override/Footer.tsx @@ -0,0 +1,134 @@ +// Custom Footer element, based partly on https://github.com/Redocly/developer-portal-starter/pull/223 +// and partly on our old jinja template for the footer component. +// It would be nice to replace this with a "thin wrapper" like Menu.tsx instead, +// but that's currently impossible because Footer is not exported from @redocly/developer-portal/ui. + +import * as React from 'react'; +import styled from 'styled-components'; + +import { Link, FooterProps, usePathPrefix } from '@redocly/developer-portal/ui'; + +/** + * Custom Navbar. The implementation below is almost identical to our default Footer + */ +export default function CustomFooter(props: FooterProps) { + // you can use columns/copyright values from props, it comes from siteConfig.yaml + // but you can also import it from a separate yaml or json file + const { columns, copyrightText } = props.footer; + const siteVersion = props.siteVersion; + + const columnsElement = columns.length ? ( + + {columns.map((column, index) => ( + + {column.group || column.label} + + {column.items.map((columnItem, columnItemInex) => + columnItem.type === 'separator' ? ( + {columnItem.label} + ) : ( + + + {columnItem.label} + + + ) + )} + + + ))} + + ) : null; + + const infoElement = + copyrightText || siteVersion ? ( + + + ) : null; + + return ( + + {columnsElement} + {infoElement} + + + ); +} + +// very important for NavWrapper to be a "footer" HTML tag +export function FooterWrapper (props) { + return ( +
+ {props.children} {} +
+ ) +} + +export function FooterColumns(props) { + return ( +
+
+ {props.children} {} +
+
+ ) +} + +export function FooterCol(props) { + return ( +
+ {props.children} {} +
+ ) +} + +export function AbsoluteBottomFooter(props) { + const prefix = usePathPrefix(); + const {copyrightText} = props; + return ( +
+
+ + XRP Ledger + +   +
+ © {copyrightText}   + Open Source. +
+
+
+ ) +} + +export function ColumnList(props) { + return ( + + ) +} + +export function ColumnListItem(props) { + return ( +
  • + {props.children} {} +
  • + ) +} + +export const FooterSeparator = styled.li` + opacity: 0.75; + margin: 10px 0 5px 0; + font-size: 0.75em; + text-transform: uppercase; + font-family: ${({ theme }) => theme.typography.headings.fontFamily}; +`; + +export const ColumnTitle = styled.h5``; + +export function JumpToTop() { + return ( + + ) +} diff --git a/docs/references/index.md b/docs/references/index.mdx similarity index 100% rename from docs/references/index.md rename to docs/references/index.mdx diff --git a/siteConfig.yaml b/siteConfig.yaml index 9a9792c..43d5087 100644 --- a/siteConfig.yaml +++ b/siteConfig.yaml @@ -48,18 +48,39 @@ nav: # Footer configuration --------------------------------------------------------- footer: - copyrightText: Copyright © 2022 XRP Ledger. Open Source. + copyrightText: Copyright © 2022 XRP Ledger. columns: - group: About items: - page: about/xrp-ledger-overview.mdx + - page: about/use-cases.mdx + - page: about/history.mdx + - label: Ledger Explorer + link: https://livenet.xrpl.org/ + - page: about/xrp-overview.mdx + - page: about/impact.mdx + - page: about/carbon-calculator.mdx + - label: XRPL Foundation + link: https://foundation.xrpl.org/ + - page: about/faq.mdx - group: Docs items: - page: docs/index.md - page: docs/concepts/introduction/intro-to-xrpl.md - label: Introduction to the XRP Ledger + - page: docs/tutorials/index.md + - page: docs/references/index.mdx + - page: docs/code-samples/index.mdx + - page: docs/dev-tools/index.md - group: Community items: - page: community/index.mdx - page: community/contribute-code.md + - page: community/events.mdx + - page: community/ambassadors.mdx + - label: XRPL Jobs + link: https://jobs.xrpl.org/ + - label: Dev Blog + page: blog/index.md + - label: GitHub + link: https://github.com/XRPLF/ - page: community/report-a-scam.md