Skip to content

Commit

Permalink
Create data file for nav items
Browse files Browse the repository at this point in the history
  • Loading branch information
frank mcmanus committed Dec 7, 2019
1 parent 4749abe commit 3bd40e2
Show file tree
Hide file tree
Showing 6 changed files with 89 additions and 90 deletions.
Binary file modified .cache/redux.state
Binary file not shown.
2 changes: 1 addition & 1 deletion src/components/Announcement.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from "react";
import styled, { createGlobalStyle, css } from 'styled-components';

export const StickerStyle = styled.div`
border: 1px solid red;
border: 1px solid black;
display: flex;
flex-direction: column;
justify-content: center;
Expand Down
101 changes: 14 additions & 87 deletions src/components/HomeNav.tsx
Original file line number Diff line number Diff line change
@@ -1,80 +1,7 @@
import { Link } from "gatsby";
import React from "react";
import styled from 'styled-components'
// import { graphql } from "gatsby"

const navLinks = [
{
rsvp: {
link: 'https://www.meetup.com/TypeScriptNYC/events/251309133/',
description: 'RSVP to our next event',
time: 'now'
}
},
{
codeOfConduct: {
link: '/code-of-conduct',
description: 'Read our code of conduct',
time: ''
}
},
{
slack: {
link: 'https://slack.com/signin',
description: 'Join our slack',
time: ''
}
},
{
venueInstructions: {
link: 'google.com',
description: 'Go to the venue and check in',
time: 'in 5 days'
}
},
{
speakers: {
link: 'google.com',
description: 'speaker stuff here',
time: '7PM'
}
},
{
end: {
link: '',
description: 'Social hour',
time: '9PM'
}
},
{
speak: {
link: 'mailto:[email protected]',
description: 'Be a future speaker',
time: ''
}
},
{
pastMeetups: {
link: '/past-meetups',
description: 'See past meetups',
time: ''
}
},
{
aboutUs: {
link: '/about',
description: 'Learn more about us',
time: ''
}
},
{
becomeASponsor: {
link: '/faq',
description: 'Become a sponsor',
time: ''
}
},
]
import navItems from '../data/nav-items.js';

export const NavFlexContainer = styled.div`
border: 3px solid green;
Expand All @@ -85,15 +12,15 @@ align-items: center;
width:100%;
`;

export const NavItemsContainer = styled.div`
// border: 3px solid green;
export const NavItemRowsContainer = styled.div`
border: 3px solid green;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
width:100%;
@media (min-width: 576px) {
width:30%;
width:50%;
max-width:300px;
}
`;
Expand All @@ -116,7 +43,7 @@ align-items: flex-start;
width:80%
`;

export const NavItem = styled.div`
export const NavItemRow = styled.div`
// border: 1px solid green;
display: flex;
flex-direction: row;
Expand All @@ -125,20 +52,20 @@ align-items: center;
width:100%
`;

const makeNavLinks = (navLinks) => {
if (navLinks.length > 0) {
return navLinks.map((item) => {
const makeNavLinks = (navItems) => {
if (navItems.length > 0) {
return navItems.map((item) => {
const itemContents = Object.values(item)[0];
let { link, description, time } = itemContents;

return <NavItem>
return <NavItemRow>
<LeftColumn>
<p>{`${time}`}</p>
</LeftColumn>
<RightColumn>
{fillRightColumn(link, description)}
</RightColumn>
</NavItem>
</NavItemRow>
})
}
}
Expand All @@ -162,12 +89,12 @@ const fillRightColumn = (link, description) => {
}

export default function HomeNav() {

console.log(navItems.list)
return (
<NavFlexContainer>
<NavItemsContainer>
{makeNavLinks(navLinks)}
</NavItemsContainer>
<NavItemRowsContainer>
{makeNavLinks(navItems.list)}
</NavItemRowsContainer>

</NavFlexContainer>
)
Expand Down
1 change: 0 additions & 1 deletion src/components/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import Header from "./Header";
import Footer from "./Footer";

export const LayoutContainer = styled.div`
border: 1px solid red;
width: 100%;
position: relative;
max-width: 600px;
Expand Down
74 changes: 74 additions & 0 deletions src/data/nav-items.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
export default {
list: [
{
rsvp: {
link: 'https://www.meetup.com/TypeScriptNYC/events/251309133/',
description: 'RSVP to our next event',
time: 'now'
}
},
{
codeOfConduct: {
link: '/code-of-conduct',
description: 'Read our code of conduct',
time: ''
}
},
{
slack: {
link: 'https://slack.com/signin',
description: 'Join our slack',
time: ''
}
},
{
venueInstructions: {
link: 'google.com',
description: 'Go to the venue and check in',
time: 'in 5 days'
}
},
{
speakers: {
link: 'google.com',
description: 'speaker stuff here',
time: '7PM'
}
},
{
end: {
link: '',
description: 'Social hour',
time: '9PM'
}
},
{
speak: {
link: 'mailto:[email protected]',
description: 'Be a future speaker',
time: ''
}
},
{
pastMeetups: {
link: '/past-meetups',
description: 'See past meetups',
time: ''
}
},
{
aboutUs: {
link: '/about',
description: 'Learn more about us',
time: ''
}
},
{
becomeASponsor: {
link: '/faq',
description: 'Become a sponsor',
time: ''
}
},
]
};
1 change: 0 additions & 1 deletion src/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import HomeNav from "../components/HomeNav";
// import { graphql } from "gatsby";

export const PageContainer = styled.div`
border: 1px solid red;
width: 100%;
position: relative;
display:flex;
Expand Down

0 comments on commit 3bd40e2

Please sign in to comment.