From 436cbb11503a9fd7d70a916e0d6ef335ebfd8cf8 Mon Sep 17 00:00:00 2001 From: Lance McCluskey Date: Wed, 24 Mar 2021 21:53:38 -0500 Subject: [PATCH 1/4] refactor: Fixing conflicts with master --- src/components/NavigationItem/index.tsx | 14 ++- src/pages/community.tsx | 115 +++++++++++++++++++++--- src/styles/community.scss | 72 +++++++++++++++ src/types/index.ts | 5 ++ 4 files changed, 189 insertions(+), 17 deletions(-) create mode 100644 src/styles/community.scss diff --git a/src/components/NavigationItem/index.tsx b/src/components/NavigationItem/index.tsx index ae9c346f15..fc068c55c0 100644 --- a/src/components/NavigationItem/index.tsx +++ b/src/components/NavigationItem/index.tsx @@ -4,6 +4,7 @@ import classnames from 'classnames'; interface Props { key: string; + isLearn?: boolean; isRead: boolean; isActive: boolean; slug: string; @@ -12,16 +13,21 @@ interface Props { } const NavigationItem = ({ + isLearn = true, isRead, isActive, slug, title, onClick, }: Props): JSX.Element => { - const className = classnames('t-body2 side-nav__item', { - 'side-nav__item--done': isRead, - 'side-nav__item--active': !isRead && isActive, - }); + const className = isLearn + ? classnames('t-body2 side-nav__item', { + 'side-nav__item--done': isRead, + 'side-nav__item--active': !isRead && isActive, + }) + : classnames('t-body2 side-nav__item-community', { + 'side-nav__item-community--active': isActive, + }); const element = useRef(null); const handleRef = (ref?: HTMLAnchorElement | null): void => { diff --git a/src/pages/community.tsx b/src/pages/community.tsx index 0dd9a7f6f9..d5b95d1cd8 100644 --- a/src/pages/community.tsx +++ b/src/pages/community.tsx @@ -1,23 +1,112 @@ +import React, { useState, useRef } from 'react'; import { graphql } from 'gatsby'; -import React from 'react'; -import { Page } from '../types'; -import PageLayout from '../components/Layout/page'; +import { Page, CommunityNavigationSection } from '../types'; +import Layout from '../components/Layout'; +import Article from '../components/Article'; +import Footer from '../components/Footer'; +import NavigationItem from '../components/NavigationItem'; -export default function CommunityPage({ data, location }: Page): JSX.Element { +import '../styles/article-reader.scss'; +import '../styles/community.scss'; + +const commNavSections: CommunityNavigationSection[] = [ + { + title: 'Comms', + sections: ['Forums', 'Mailing Lists', 'Chats'], + }, + { + title: 'Jobs', + sections: [], + }, + { + title: 'Conferences', + sections: ['Future Conferences', 'Past Conferences'], + }, + { + title: 'Community', + sections: ['User Groups', 'Meet-ups'], + }, + { + title: 'News', + sections: ['Official Publications', 'Community Publications', 'Podcasts'], + }, + { + title: 'Education', + sections: ['Community Resources'], + }, + { + title: 'Tooling', + sections: ['3rd Party Libraries'], + }, + { + title: 'Collaboration', + sections: ['Contributing', 'Reporting Issues'], + }, +]; + +export default function CommunityPage({ data }: Page): JSX.Element { const { title, description } = data.page.frontmatter; const { html, tableOfContents } = data.page; const { authors } = data.page.fields; + const [navOpen, setNavOpen] = useState(false); + const navElement = useRef(null); + const toggle = (): void => setNavOpen(!navOpen); + const className = navOpen ? 'side-nav side-nav--open' : 'side-nav'; + return ( - + <> + +
+ +
+
+
+