diff --git a/src/components/HomeHeader/index.tsx b/src/components/HomeHeader/index.tsx index b9a671a..918ed79 100644 --- a/src/components/HomeHeader/index.tsx +++ b/src/components/HomeHeader/index.tsx @@ -14,6 +14,15 @@ interface IMenuItemProps { } const MenuItem: FC = ({ children, to }) => { + if (to.match(/^(https?:\/\/)/)) { + return ( + + {children} + + + ) + } + return ( = ({ isHome }) => { rules resources tech spotlights + + forum + join us {isHome && } diff --git a/src/components/HomeHeader/styles.tsx b/src/components/HomeHeader/styles.tsx index 1243fcb..1c5312c 100644 --- a/src/components/HomeHeader/styles.tsx +++ b/src/components/HomeHeader/styles.tsx @@ -1,6 +1,6 @@ import { Link } from "gatsby" import Particles from "react-particles-js" -import styled from "styled-components" +import styled, { css } from "styled-components" import TPHLogo from "../../images/tph-logo.svg" export const HomeHeaderWrapper = styled.header` @@ -144,7 +144,7 @@ export const MenuItemLine = styled.div` transition: all 0.3s; ` -export const MenuItem = styled(Link)` +export const menuItemStyles = css` display: flex; align-items: center; font-size: 22px; @@ -198,3 +198,11 @@ export const MenuItem = styled(Link)` } } ` + +export const MenuItem = styled(Link)` + ${menuItemStyles}; +` + +export const MenuItemExternal = styled.a` + ${menuItemStyles}; +` diff --git a/src/components/Sidebar/index.tsx b/src/components/Sidebar/index.tsx index cc58bd8..5d5572b 100644 --- a/src/components/Sidebar/index.tsx +++ b/src/components/Sidebar/index.tsx @@ -11,6 +11,14 @@ interface IMenuItemProps { } const MenuItem: FC = ({ children, to }) => { + if (to.match(/^(https?:\/\/)/)) { + return ( + + {children} + + ) + } + return ( {children} @@ -37,6 +45,9 @@ export const Sidebar: FCrules resources tech spotlights + + forum + diff --git a/src/components/Sidebar/styles.tsx b/src/components/Sidebar/styles.tsx index 9df9c15..8c6646d 100644 --- a/src/components/Sidebar/styles.tsx +++ b/src/components/Sidebar/styles.tsx @@ -1,5 +1,5 @@ import { Link } from "gatsby" -import styled from "styled-components" +import styled, { css } from "styled-components" export const SidebarWrapper = styled.div` box-sizing: border-box; @@ -39,7 +39,7 @@ export const Menu = styled.nav` padding-top: 20px; ` -export const MenuItem = styled(Link)` +export const menuItemStyles = css` padding: 4px 0; font-size: 20px; color: ${props => props.theme.sidebar.foreground}; @@ -54,3 +54,11 @@ export const MenuItem = styled(Link)` font-weight: 700; } ` + +export const MenuItem = styled(Link)` + ${menuItemStyles}; +` + +export const MenuItemExternal = styled.a` + ${menuItemStyles}; +`