mirror of
https://github.com/XRPLF/xrpl-dev-portal.git
synced 2025-11-04 20:05:50 +00:00
Update Navigation for Blog site
This commit is contained in:
136
@theme/components/Footer/BlogFooter.tsx
Normal file
136
@theme/components/Footer/BlogFooter.tsx
Normal file
@@ -0,0 +1,136 @@
|
|||||||
|
import * as React from 'react';
|
||||||
|
import styled from 'styled-components';
|
||||||
|
import { useThemeConfig } from '@theme/hooks/useThemeConfig';
|
||||||
|
import { useTranslate } from '@portal/hooks';
|
||||||
|
import { useLocation } from 'react-router-dom';
|
||||||
|
|
||||||
|
export function BlogFooter(props) {
|
||||||
|
const themeConfig = useThemeConfig();
|
||||||
|
const { pathname } = useLocation();
|
||||||
|
const { translate } = useTranslate();
|
||||||
|
|
||||||
|
// Provide different footer links for the Blog site.
|
||||||
|
if (pathname.includes("blog")) {
|
||||||
|
themeConfig.footer.items = [
|
||||||
|
{
|
||||||
|
label: translate("Learn"),
|
||||||
|
type: "group",
|
||||||
|
items: [
|
||||||
|
{
|
||||||
|
type: "link",
|
||||||
|
fsPath: "about/index.page.tsx",
|
||||||
|
label: translate("Overview"),
|
||||||
|
link: "/about/",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: "link",
|
||||||
|
fsPath: "about/uses.page.tsx",
|
||||||
|
label: translate("Uses"),
|
||||||
|
link: "/about/uses",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: "link",
|
||||||
|
fsPath: "about/history.page.tsx",
|
||||||
|
label: translate("History"),
|
||||||
|
link: "/about/history",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: "link",
|
||||||
|
fsPath: "about/impact.page.tsx",
|
||||||
|
label: translate("Impact"),
|
||||||
|
link: "/about/impact",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: "link",
|
||||||
|
fsPath: "about/impact.page.tsx",
|
||||||
|
label: translate("Carbon Calculator"),
|
||||||
|
link: "/about/impact",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: translate("Explore"),
|
||||||
|
type: "group",
|
||||||
|
items: [
|
||||||
|
{
|
||||||
|
type: "link",
|
||||||
|
fsPath: "/docs/introduction/crypto-wallets.md",
|
||||||
|
label: translate("Wallets"),
|
||||||
|
link: "/docs/introduction/crypto-wallets",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: "link",
|
||||||
|
fsPath: "about/xrp.page.tsx",
|
||||||
|
label: translate("Exchanges"),
|
||||||
|
link: "/about/xrp",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: "link",
|
||||||
|
fsPath: "about/uses.page.tsx",
|
||||||
|
label: translate("Businesses"),
|
||||||
|
link: "/about/uses",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: "link",
|
||||||
|
fsPath: "",
|
||||||
|
label: translate("Ledger Explorer"),
|
||||||
|
link: "https://livenet.xrpl.org/",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: translate("Build"),
|
||||||
|
type: "group",
|
||||||
|
items: [
|
||||||
|
{
|
||||||
|
type: "link",
|
||||||
|
fsPath: "/docs/tutorials/index.md",
|
||||||
|
label: translate("Get Started"),
|
||||||
|
link: "/docs/tutorials",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: "link",
|
||||||
|
fsPath: "/docs/index.page.tsx",
|
||||||
|
label: translate("Docs"),
|
||||||
|
link: "/docs/",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: "link",
|
||||||
|
fsPath: "/resources/dev-tools/index.page.tsx",
|
||||||
|
label: translate("Dev Tools"),
|
||||||
|
link: "/resources/dev-tools/",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: "link",
|
||||||
|
fsPath: "/blog/index.page.tsx",
|
||||||
|
label: translate("Dev Blog"),
|
||||||
|
link: "/blog/",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: translate("Contribute"),
|
||||||
|
type: "group",
|
||||||
|
items: [
|
||||||
|
{
|
||||||
|
type: "link",
|
||||||
|
fsPath: "/resources/contribute-code/index.md",
|
||||||
|
label: translate("How to Contribute"),
|
||||||
|
link: "/resources/contribute-code",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: "link",
|
||||||
|
fsPath: "",
|
||||||
|
label: translate("XRPL on Github"),
|
||||||
|
link: "https://github.com/XRPLF/xrpl-dev-portal",
|
||||||
|
external: true,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
// NOTE: We don't render anything because we only want to change the footer data,
|
||||||
|
// but the design should remain the same.
|
||||||
|
return null;
|
||||||
|
}
|
||||||
@@ -2,7 +2,7 @@ import * as React from 'react';
|
|||||||
import styled from 'styled-components';
|
import styled from 'styled-components';
|
||||||
import { useThemeConfig } from '@theme/hooks/useThemeConfig';
|
import { useThemeConfig } from '@theme/hooks/useThemeConfig';
|
||||||
import { LanguagePicker } from '@theme/i18n/LanguagePicker';
|
import { LanguagePicker } from '@theme/i18n/LanguagePicker';
|
||||||
import { useI18n } from '@portal/hooks';
|
import { useI18n, useTranslate } from '@portal/hooks';
|
||||||
|
|
||||||
import { slugify } from '../../helpers';
|
import { slugify } from '../../helpers';
|
||||||
|
|
||||||
@@ -10,6 +10,8 @@ import { Link } from '@portal/Link';
|
|||||||
import { ColorModeSwitcher } from '@theme/components/ColorModeSwitcher/ColorModeSwitcher';
|
import { ColorModeSwitcher } from '@theme/components/ColorModeSwitcher/ColorModeSwitcher';
|
||||||
import { Search } from '@theme/components/Search/Search';
|
import { Search } from '@theme/components/Search/Search';
|
||||||
|
|
||||||
|
import { useLocation } from 'react-router-dom';
|
||||||
|
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
// import navbar from '../../../top-nav.yaml';
|
// import navbar from '../../../top-nav.yaml';
|
||||||
|
|
||||||
@@ -44,6 +46,31 @@ export function Navbar(props) {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const { pathname } = useLocation();
|
||||||
|
const blogNavs = getBlogNavigationConfig();
|
||||||
|
|
||||||
|
const blogNavItems = [];
|
||||||
|
for (const blogNav of blogNavs) {
|
||||||
|
if (blogNav.type === "group") {
|
||||||
|
blogNavItems.push(
|
||||||
|
<NavDropdown
|
||||||
|
key={blogNav.index}
|
||||||
|
label={blogNav.label}
|
||||||
|
items={blogNav.items}
|
||||||
|
pathPrefix={pathPrefix}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
blogNavItems.push(
|
||||||
|
<NavItem key={blogNav.index}>
|
||||||
|
<Link to={blogNav.link} className="nav-link">
|
||||||
|
{blogNav.label}
|
||||||
|
</Link>
|
||||||
|
</NavItem>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
React.useEffect(() => {
|
React.useEffect(() => {
|
||||||
// Turns out jQuery is necessary for firing events on Bootstrap v4
|
// Turns out jQuery is necessary for firing events on Bootstrap v4
|
||||||
// dropdowns. These events set classes so that the search bar and other
|
// dropdowns. These events set classes so that the search bar and other
|
||||||
@@ -78,36 +105,73 @@ export function Navbar(props) {
|
|||||||
};
|
};
|
||||||
},[]);
|
},[]);
|
||||||
|
|
||||||
return (
|
// Render a different top nav for the Blog site.
|
||||||
<>
|
if (pathname.includes("blog")) {
|
||||||
{/* <AlertBanner
|
return (
|
||||||
|
<>
|
||||||
|
{/* <AlertBanner
|
||||||
show={alertBanner.show}
|
show={alertBanner.show}
|
||||||
message={alertBanner.message}
|
message={alertBanner.message}
|
||||||
button={alertBanner.button}
|
button={alertBanner.button}
|
||||||
link={alertBanner.link}
|
link={alertBanner.link}
|
||||||
/> */}
|
/> */}
|
||||||
<NavWrapper>
|
<NavWrapper>
|
||||||
<LogoBlock to={href} img={logo} alt={altText} />
|
<LogoBlock to={href} img={logo} alt={altText} />
|
||||||
<NavControls>
|
<NavControls>
|
||||||
<MobileMenuIcon />
|
<MobileMenuIcon />
|
||||||
</NavControls>
|
</NavControls>
|
||||||
<TopNavCollapsible>
|
<TopNavCollapsible>
|
||||||
<NavItems>
|
<NavItems>
|
||||||
{navItems}
|
{blogNavItems}
|
||||||
<div id="topnav-search" className="nav-item search">
|
<div id="topnav-search" className="nav-item search">
|
||||||
<Search className="topnav-search" />
|
<Search className="topnav-search" />
|
||||||
</div>
|
</div>
|
||||||
<div id="topnav-language" className="nav-item">
|
<div id="topnav-button" className="nav-item">
|
||||||
<LanguagePicker onChangeLanguage={changeLanguage} onlyIcon />
|
<GetStartedButton />
|
||||||
</div>
|
</div>
|
||||||
<div id="topnav-theme" className="nav-item">
|
<div id="topnav-language" className="nav-item">
|
||||||
<StyledColorModeSwitcher />
|
<LanguagePicker onChangeLanguage={changeLanguage} onlyIcon />
|
||||||
</div>
|
</div>
|
||||||
</NavItems>
|
<div id="topnav-theme" className="nav-item">
|
||||||
</TopNavCollapsible>
|
<StyledColorModeSwitcher />
|
||||||
</NavWrapper>
|
</div>
|
||||||
</>
|
</NavItems>
|
||||||
);
|
</TopNavCollapsible>
|
||||||
|
</NavWrapper>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
{/* <AlertBanner
|
||||||
|
show={alertBanner.show}
|
||||||
|
message={alertBanner.message}
|
||||||
|
button={alertBanner.button}
|
||||||
|
link={alertBanner.link}
|
||||||
|
/> */}
|
||||||
|
<NavWrapper>
|
||||||
|
<LogoBlock to={href} img={logo} alt={altText} />
|
||||||
|
<NavControls>
|
||||||
|
<MobileMenuIcon />
|
||||||
|
</NavControls>
|
||||||
|
<TopNavCollapsible>
|
||||||
|
<NavItems>
|
||||||
|
{navItems}
|
||||||
|
<div id="topnav-search" className="nav-item search">
|
||||||
|
<Search className="topnav-search" />
|
||||||
|
</div>
|
||||||
|
<div id="topnav-language" className="nav-item">
|
||||||
|
<LanguagePicker onChangeLanguage={changeLanguage} onlyIcon />
|
||||||
|
</div>
|
||||||
|
<div id="topnav-theme" className="nav-item">
|
||||||
|
<StyledColorModeSwitcher />
|
||||||
|
</div>
|
||||||
|
</NavItems>
|
||||||
|
</TopNavCollapsible>
|
||||||
|
</NavWrapper>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const StyledColorModeSwitcher = styled(ColorModeSwitcher)`
|
const StyledColorModeSwitcher = styled(ColorModeSwitcher)`
|
||||||
@@ -260,6 +324,16 @@ export function MobileMenuIcon() {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function GetStartedButton() {
|
||||||
|
const { translate } = useTranslate();
|
||||||
|
|
||||||
|
return (
|
||||||
|
<a className="btn btn-primary" href={"/docs/tutorials"} style={{ height: "38px", paddingTop: "11px"}}>
|
||||||
|
{translate("Get Started")}
|
||||||
|
</a>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
export function NavItems(props) {
|
export function NavItems(props) {
|
||||||
return (
|
return (
|
||||||
<ul className="nav navbar-nav" id="topnav-pages">
|
<ul className="nav navbar-nav" id="topnav-pages">
|
||||||
@@ -339,3 +413,131 @@ export class ThemeToggle extends React.Component {
|
|||||||
this.auto_update_theme();
|
this.auto_update_theme();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getBlogNavigationConfig() {
|
||||||
|
const { translate } = useTranslate();
|
||||||
|
|
||||||
|
return [
|
||||||
|
{
|
||||||
|
index: "0",
|
||||||
|
label: translate("Learn"),
|
||||||
|
type: "group",
|
||||||
|
items: [
|
||||||
|
{
|
||||||
|
type: "group",
|
||||||
|
label: translate("XRP Ledger"),
|
||||||
|
items: [
|
||||||
|
{
|
||||||
|
type: "link",
|
||||||
|
fsPath: "about/index.page.tsx",
|
||||||
|
label: translate("Overview"),
|
||||||
|
link: "/about/",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: "link",
|
||||||
|
fsPath: "about/uses.page.tsx",
|
||||||
|
label: translate("Uses"),
|
||||||
|
link: "/about/uses",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: "link",
|
||||||
|
fsPath: "about/history.page.tsx",
|
||||||
|
label: translate("History"),
|
||||||
|
link: "/about/history",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: "link",
|
||||||
|
fsPath: "about/impact.page.tsx",
|
||||||
|
label: translate("Impact"),
|
||||||
|
link: "/about/impact",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: "link",
|
||||||
|
fsPath: "about/impact.page.tsx",
|
||||||
|
label: translate("Carbon Calculator"),
|
||||||
|
link: "/about/impact",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
pathPrefix: "",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
index: "1",
|
||||||
|
label: translate("Explore"),
|
||||||
|
type: "group",
|
||||||
|
items: [
|
||||||
|
{
|
||||||
|
type: "group",
|
||||||
|
label: translate("Explore the XRP Ledger"),
|
||||||
|
items: [
|
||||||
|
{
|
||||||
|
type: "link",
|
||||||
|
fsPath: "/docs/introduction/crypto-wallets.md",
|
||||||
|
label: translate("Wallets"),
|
||||||
|
link: "/docs/introduction/crypto-wallets",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: "link",
|
||||||
|
fsPath: "about/xrp.page.tsx",
|
||||||
|
label: translate("Exchanges"),
|
||||||
|
link: "/about/xrp",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: "link",
|
||||||
|
fsPath: "about/uses.page.tsx",
|
||||||
|
label: translate("Businesses"),
|
||||||
|
link: "/about/uses",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: "link",
|
||||||
|
fsPath: "",
|
||||||
|
label: translate("Ledger Explorer"),
|
||||||
|
link: "https://livenet.xrpl.org/",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
pathPrefix: "",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
index: "2",
|
||||||
|
label: translate("Build"),
|
||||||
|
type: "group",
|
||||||
|
items: [
|
||||||
|
{
|
||||||
|
type: "group",
|
||||||
|
label: translate("Build with XRPL"),
|
||||||
|
items: [
|
||||||
|
{
|
||||||
|
type: "link",
|
||||||
|
fsPath: "/docs/index.page.tsx",
|
||||||
|
label: translate("Docs"),
|
||||||
|
link: "/docs/",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: "link",
|
||||||
|
fsPath: "/resources/dev-tools/index.page.tsx",
|
||||||
|
label: translate("Dev Tools"),
|
||||||
|
link: "/resources/dev-tools/",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: "link",
|
||||||
|
fsPath: "/blog/index.page.tsx",
|
||||||
|
label: translate("Dev Blog"),
|
||||||
|
link: "/blog/",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
pathPrefix: "",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
index: "3",
|
||||||
|
type: "link",
|
||||||
|
fsPath: "community/index.page.tsx",
|
||||||
|
label: translate("Contribute"),
|
||||||
|
link: "/community",
|
||||||
|
},
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import * as React from "react";
|
|||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { useTranslate, usePageSharedData } from "@portal/hooks";
|
import { useTranslate, usePageSharedData } from "@portal/hooks";
|
||||||
import moment from "moment";
|
import moment from "moment";
|
||||||
|
import { BlogFooter } from "@theme/components/Footer/BlogFooter";
|
||||||
|
|
||||||
export const frontmatter = {
|
export const frontmatter = {
|
||||||
seo: {
|
seo: {
|
||||||
@@ -123,8 +124,8 @@ export default function Index() {
|
|||||||
|
|
||||||
{/* Other Blog Posts*/}
|
{/* Other Blog Posts*/}
|
||||||
<section className="container-new py-26">
|
<section className="container-new py-26">
|
||||||
<div className="row col-12 m-0 p-0 mt-4 pt-2">
|
<div className="row w-100 mx-auto px-2">
|
||||||
<div className="left col-3 m-0 p-0 mt-2 d-none d-lg-block">
|
<div className="row-cols-lg-2 m-0 p-0 mt-2 d-none d-lg-block">
|
||||||
{/* Filters Desktop*/}
|
{/* Filters Desktop*/}
|
||||||
<div className="p-3 category_sidebar">
|
<div className="p-3 category_sidebar">
|
||||||
<p className="mb-3 category-header">Filter by Category:</p>
|
<p className="mb-3 category-header">Filter by Category:</p>
|
||||||
@@ -155,27 +156,27 @@ export default function Index() {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{/* Cards */}
|
{/* Cards */}
|
||||||
<div className="right row col row-cols-lg-2 m-0 p-0">
|
<div className="row col row-cols-lg-2 m-0 p-0">
|
||||||
{filteredCards.map((card, i) => (
|
{filteredCards.map((card, i) => (
|
||||||
<div
|
<div
|
||||||
key={card.title + i}
|
key={card.title + i}
|
||||||
className={`${card.category_id} col-sm pb-5 px-lg-4`}
|
className={`${card.category_id} pb-5 px-lg-4`}
|
||||||
id={card.title + i}
|
id={card.title + i}
|
||||||
>
|
>
|
||||||
<div className="mb-4" id="category-list">
|
<div className="mb-4" id="category-list">
|
||||||
<img
|
<img
|
||||||
alt="default-alt-text"
|
alt="default-alt-text"
|
||||||
id={`${card.category_id}`}
|
id={`${card.category_id}`}
|
||||||
className="w-100 mb-4"
|
className="mb-4"
|
||||||
/>
|
/>
|
||||||
<p
|
<p
|
||||||
id={`${card.category_id}-badge`}
|
id={`${card.category_id}-badge`}
|
||||||
className="category-badge mb-5"
|
className="category-badge"
|
||||||
>
|
>
|
||||||
{translate(card.category)}
|
{translate(card.category)}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<div className="mb-4">
|
<div>
|
||||||
<p id="card-date" className="mb-0">
|
<p id="card-date" className="mb-0">
|
||||||
{moment(translate(card.date)).format("MMM DD, YYYY")}
|
{moment(translate(card.date)).format("MMM DD, YYYY")}
|
||||||
</p>
|
</p>
|
||||||
@@ -198,6 +199,7 @@ export default function Index() {
|
|||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
</div>
|
</div>
|
||||||
|
<BlogFooter />
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -103,6 +103,8 @@
|
|||||||
{
|
{
|
||||||
##{$category} {
|
##{$category} {
|
||||||
content: url("../img/blog/#{$category}.png");
|
content: url("../img/blog/#{$category}.png");
|
||||||
|
max-width:100%;
|
||||||
|
width:100%;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -318,6 +318,10 @@ $nav-height: 80px;
|
|||||||
margin-left: 3.5rem;
|
margin-left: 3.5rem;
|
||||||
margin-right: 0.5rem;
|
margin-right: 0.5rem;
|
||||||
}
|
}
|
||||||
|
#topnav-button {
|
||||||
|
margin-left: 0.2rem;
|
||||||
|
margin-right: 1rem;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} // End desktop styles
|
} // End desktop styles
|
||||||
|
|
||||||
@@ -379,6 +383,12 @@ $nav-height: 80px;
|
|||||||
background-color: $gray-900;
|
background-color: $gray-900;
|
||||||
padding: 1rem;
|
padding: 1rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#topnav-button {
|
||||||
|
background-color: $gray-900;
|
||||||
|
padding: 1rem 1.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
#topnav-search {
|
#topnav-search {
|
||||||
background-color: $gray-900;
|
background-color: $gray-900;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user