Skip to content

new branch with the clean up of nav, buttons and others #61

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 50 commits into from
Sep 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
af5d559
new branch with the clean up of nav, buttons and others
OlliesWorld Aug 30, 2023
c655822
add explicit type for s in layout
OlliesWorld Aug 30, 2023
685a8b9
another try at fixing types
OlliesWorld Aug 30, 2023
afd7356
add type to line 101
OlliesWorld Aug 30, 2023
2a196a7
add if statement for dropdown closing on refresh/load
OlliesWorld Aug 30, 2023
159f771
update alignment for logo and content
OlliesWorld Aug 31, 2023
f3f20a4
center sponsored logos, fix scroll on nav link
OlliesWorld Sep 5, 2023
d44766a
added router to topnav for active state, added preventDefault for sid…
OlliesWorld Sep 5, 2023
3c4e289
Correct some build errors
benjagm Sep 6, 2023
03bd9f7
Temporary fix to correct build error
benjagm Sep 6, 2023
07c689f
Temporary fix for unused variable
benjagm Sep 6, 2023
46d2cd1
Disable eslint rule to avoid build error
benjagm Sep 6, 2023
3d445fb
disable eslint rule
benjagm Sep 6, 2023
a883d4c
Adding eslint ts-ignore
benjagm Sep 6, 2023
418c3cb
Disable ts eslint rule
benjagm Sep 6, 2023
c68bbb9
Updated orbit logo
benjagm Sep 6, 2023
9e6c6c4
New orbit logo
benjagm Sep 6, 2023
974d4ad
supported by logos styling
benjagm Sep 6, 2023
9149f54
Center supported by logos
benjagm Sep 6, 2023
41adc30
Linebreak before email support us
benjagm Sep 6, 2023
5c83adb
Some minor corrections
benjagm Sep 6, 2023
f6b4bd3
Increase spacing between logos
benjagm Sep 6, 2023
893c298
Changes in the style
benjagm Sep 6, 2023
6ef0385
Changes to adjust the logo alignment
benjagm Sep 6, 2023
a741c3e
Still aligning the logos
benjagm Sep 6, 2023
963ed7e
Changes in the style
benjagm Sep 6, 2023
7ed138c
Different approach for logos alignment
benjagm Sep 6, 2023
c2139d7
Reverting back all the changes in the logos alignment
benjagm Sep 6, 2023
8b3e233
Logos w from 44 to 64
benjagm Sep 6, 2023
fb7a96c
Sponsors vertically centered.
benjagm Sep 6, 2023
1926a81
Final adjustments in logos styling
benjagm Sep 6, 2023
c3e071b
Change wording in support us.
benjagm Sep 6, 2023
b0a670d
update supported and community section
OlliesWorld Sep 6, 2023
bb9c50b
Update index.page.tsx
benjagm Sep 7, 2023
29656f9
Update events logic to include single instance events and sort by date
benjagm Sep 7, 2023
56483f5
Fix typo
benjagm Sep 7, 2023
f3af0e0
CarbonAds location
benjagm Sep 7, 2023
77236db
Change carbonads location
benjagm Sep 7, 2023
a738bf8
Add a separation line between implementations
benjagm Sep 7, 2023
ba4b280
Fix typo
benjagm Sep 7, 2023
c63fb87
Move implementations style to different css
benjagm Sep 7, 2023
b748c4f
Move style to different row in implementations
benjagm Sep 7, 2023
c286b3c
Padding in the separation line of implementations
benjagm Sep 7, 2023
fee21e1
Add padding top to implementations style
benjagm Sep 7, 2023
acf4f1a
Changes to better align the supported by logos.
benjagm Sep 8, 2023
eae0403
Fix typos
benjagm Sep 8, 2023
354291e
redo sidenav active
OlliesWorld Sep 10, 2023
8482c20
Improvements on the blog post view
benjagm Sep 11, 2023
6c48164
fix mobile docs nav
OlliesWorld Sep 11, 2023
be3973c
Fine tune blog and header styles.
benjagm Sep 12, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
265 changes: 50 additions & 215 deletions components/Layout.tsx

Large diffs are not rendered by default.

260 changes: 235 additions & 25 deletions components/Sidebar.tsx

Large diffs are not rendered by default.

11 changes: 8 additions & 3 deletions components/SiteLayout.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
import Layout from '../components/Layout'
import React from 'react'

export const SiteLayout = ({ children }: { children: React.ReactNode}): JSX.Element => {
type SiteLayoutProps = {
children: React.ReactNode
isDropdown?: boolean
}

export const SiteLayout: React.FC<SiteLayoutProps> = ({ children }): JSX.Element => {
return (
<Layout>
<Layout >
{children}
</Layout>
)
}

export const getLayout = (page: React.ReactNode): JSX.Element => {
return <SiteLayout >{page}</SiteLayout>
}
}
2 changes: 1 addition & 1 deletion components/StyledMarkdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ export function TableOfContentMarkdown ({ markdown, depth = 2 }: { markdown: str
)
}
} : { component: () => null },
...hiddenElements('strong', 'p', 'a', 'ul', 'table', 'code', 'pre', 'blockquote', 'span', 'div', 'figure', 'Bigquote'),
...hiddenElements('strong', 'p', 'a', 'ul', 'li', 'table', 'code', 'pre', 'blockquote', 'span', 'div', 'figure', 'Bigquote'),
}
}}
>
Expand Down
10 changes: 1 addition & 9 deletions next.config.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,7 @@
/** @type {import('next').NextConfig} */
const nextConfig = {
reactStrictMode: true,
pageExtensions: ['page.tsx'],
async redirects () {
return [{
source: '/slack',
destination: 'https://json-schema.slack.com/join/shared_invite/zt-1tc77c02b-z~UiKXqpM2gHchClKbUoXw#/shared-invite/email',
permanent: false,
basePath: false,
}]
}
pageExtensions: ['page.tsx']
}

module.exports = nextConfig
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
"lint-fix": "eslint . --ext .tsx --ext .ts --fix --max-warnings 0",
"ts": "tsc --noEmit"
},
"engines": {
"node": "16.0.0"
},
"dependencies": {
"@docsearch/react": "3.3.3",
"@types/js-yaml": "^4.0.5",
Expand Down
4 changes: 3 additions & 1 deletion pages/blog/index.page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ export default function StaticMarkdownPage({ blogPosts }: { blogPosts: any[] })
const setOfTags: any[] = blogPosts.map((tag) => tag.frontmatter.type)
const spreadTags: any[] = [...setOfTags]
const allTags = [...new Set(spreadTags)]

//add tag for all
allTags.unshift('All')
const [filterTag, setFilterTag] = useState('')
const handleClick = (event: { currentTarget: { value: any } }) => {
const clickedTag = event.currentTarget.value
Expand Down Expand Up @@ -132,6 +133,7 @@ export default function StaticMarkdownPage({ blogPosts }: { blogPosts: any[] })
}).filter(
post => {
if (post.frontmatter.type === filterTag) return true
else if (filterTag === 'All') return true
else if (filterTag === '') return true
}
)
Expand Down
17 changes: 8 additions & 9 deletions pages/blog/posts/[slug].page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,17 @@ export default function StaticMarkdownPage ({ frontmatter, content }: { frontmat
<Head>
<title>{frontmatter.title}</title>
</Head>
<div className='flex flex-col py-12'>
<div className='flex flex-col pt-6'>
{frontmatter.date && (
<div className='text-center text-sm text-slate-500'>
<div className='text-center text-sm text-slate-500 mt-16'>
{date.toLocaleDateString('en-us', { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric' })} &middot; {timeToRead} min read
</div>
)}
<Headline1 attributes={{ className: 'text-center' }}>{frontmatter.title || 'NO TITLE!'}</Headline1>
</div>

<div className='relative flex flex-col lg:flex-row'>
<div className='flex lg:w-1/4 pr-4 pr-8'>
<div className='block -mt-4 w-full'>
<div className='flex pr-4 ml-10 lg:w-1/4'>
<div className='block -mt-2 w-full'>
<div className='sticky top-0 overflow-y-auto h-auto pt-4 w-full w-full items-center lg:items-start flex justify-between flex-row lg:flex-col'>
<Link href='/blog'>
<a className='font-semibold text-sm pb-0 lg:pb-5 text-slate-700 hover:text-slate-800 inline-flex flex-row items-center'>
Expand All @@ -42,7 +41,7 @@ export default function StaticMarkdownPage ({ frontmatter, content }: { frontmat
<div className='pt-6 lg:border-t border-slate-100 pr-4 border-none lg:border-r border-slate-100'>
{(frontmatter.authors || []).map((author: any, index: number) => {
return (
<div key={index} className='flex flex-row items-center mb-3'>
<div key={index} className='flex flex-row items-center mb-3 w-full'>
<div
className='bg-slate-50 h-[44px] w-[44px] rounded-full mr-3 bg-cover bg-center'
style={{ backgroundImage: `url(${author.photo})` }}
Expand All @@ -59,15 +58,15 @@ export default function StaticMarkdownPage ({ frontmatter, content }: { frontmat
)
})}
</div>
<div className='pt-12 pr-4 border-r border-slate-100 hidden lg:block'>
<div className='pt-12 pr-4 border-r border-slate-100 hidden lg:block w-full'>
<div className='uppercase text-xs text-slate-400 mb-4'>on this page</div>
<TableOfContentMarkdown markdown={content} />
<TableOfContentMarkdown markdown={content} depth={0} />
</div>
</div>
</div>

</div>
<div className='flex-1'>
<div className='flex-1 mr-4 ml-4 lg:w-3/4'>
<div
className='bg-slate-50 h-[400px] w-full rounded-lg mr-3 bg-cover mb-10 bg-center'
style={{ backgroundImage: `url(${frontmatter.cover})` }}
Expand Down
2 changes: 1 addition & 1 deletion pages/blog/posts/the-last-breaking-change.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: "The Last Breaking Change"
date: "2023-02-22"
date: "2023-02-23"
tags:
- Specification
type: Engineering
Expand Down
20 changes: 11 additions & 9 deletions pages/implementations/index.page.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react'
import { getLayout } from '~/components/Sidebar'
import { getLayout } from '~/components/SiteLayout'
import fs from 'fs'
import matter from 'gray-matter'
import StyledMarkdown from '~/components/StyledMarkdown'
Expand Down Expand Up @@ -39,12 +39,14 @@ type ImplementationByLanguage = { name: string }
export default function ImplementationsPages ({ blocks, validators, hyperLibaries }: { blocks: any, validators: ImplementationByLanguage[], hyperLibaries: ImplementationByLanguage[] }) {
return (
<SectionContext.Provider value='implementations'>
<Headline1>Implementations</Headline1>
<StyledMarkdown markdown={blocks.intro} />
<Headline2>Validators</Headline2>
<ImplementationTable implementationsByLanguage={validators} prefix='validators-' />
<StyledMarkdown markdown={blocks.main} />
<ImplementationTable implementationsByLanguage={hyperLibaries} prefix='hyper-libaries-' />
<div className='w-5/6 mx-auto mt-12'>
<Headline1>Implementations</Headline1>
<StyledMarkdown markdown={blocks.intro} />
<Headline2>Validators</Headline2>
<ImplementationTable implementationsByLanguage={validators} prefix='validators-' />
<StyledMarkdown markdown={blocks.main} />
<ImplementationTable implementationsByLanguage={hyperLibaries} prefix='hyper-libaries-' />
</div>
</SectionContext.Provider>
)
}
Expand Down Expand Up @@ -110,15 +112,15 @@ function ImplementationTable ({ implementationsByLanguage, prefix }: { implement
]
return (
<tr key={index}
className='pl-4 list-disc list-inside pl-2'
className='pl-4 list-disc list-inside pl-2 separation-line'
>
<td className=''>
<a className='text-blue-500' href={implementation.url}>{implementation.name}</a>
</td>
<td className='pl-6'>
<StyledMarkdown markdown={implementation.notes} />
</td>
<td className='pl-6 pb-2'>
<td className='pl-6 pb-2 pt-2'>
{allDrafts
?.sort((a, b) => DRAFT_ORDER.indexOf(a) < DRAFT_ORDER.indexOf(b) ? -1 : 1)
?.map((draft: string | number) => (
Expand Down
50 changes: 28 additions & 22 deletions pages/index.page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@ import { GetStaticProps } from 'next'
import axios from 'axios'
import ical from 'node-ical'
import moment from 'moment'
// import dayjs from 'dayjs'
// import localizedFormat from 'dayjs/plugin/localizedFormat'
// import isBetween from 'dayjs/plugin/isBetween'

/* eslint-enable */
export const getStaticProps: GetStaticProps = async () => {
Expand Down Expand Up @@ -68,8 +65,6 @@ export const getStaticProps: GetStaticProps = async () => {
}
// Function to filter and print events for the next 4 weeks from today
function printEventsForNextFourWeeks(icalData: { [x: string]: any }) {
// dayjs.extend(localizedFormat)
// dayjs.extend(isBetween)
const arrayDates = []
if (!icalData) {
console.error('iCal data is empty or invalid.')
Expand All @@ -79,6 +74,8 @@ function printEventsForNextFourWeeks(icalData: { [x: string]: any }) {
// Calculate the range of dates for the next 4 weeks from today
const today = moment().startOf('day')
const nextFourWeeksEnd = moment().add(4, 'weeks').endOf('day')



// Loop through the events in the iCal data
for (const k in icalData) {
Expand All @@ -89,7 +86,7 @@ function printEventsForNextFourWeeks(icalData: { [x: string]: any }) {

// Get the timezone of the event
const timezone = event.tz || 'UTC' // Default to UTC if timezone information is not provided

// Complicated case - if an RRULE exists, handle multiple recurrences of the event.
if (event.rrule !== undefined) {
// For recurring events, get the set of event start dates that fall within the range
Expand All @@ -114,13 +111,23 @@ function printEventsForNextFourWeeks(icalData: { [x: string]: any }) {
}
}
}
else {
// Simple case - no recurrences, just print out the calendar event.
if (startDate.isBetween(today, nextFourWeeksEnd, undefined, '[]')) {
const time = startDate.format('MMMM Do YYYY, h:mm a')
const day = startDate.format('D')
arrayDates.push({ title, time, day, timezone })
}
}
}
}

arrayDates.sort((x, y) => +new Date(x.time) - +new Date(y.time))

return arrayDates
}
const Home = (props: any) => {
const blogPosts = props.blogPosts
// console.log('anything', props.datesInfo)
const timeToRead = Math.ceil(readingTime(blogPosts[0].content).minutes)

return (
Expand Down Expand Up @@ -148,16 +155,16 @@ const Home = (props: any) => {
</div>
</div>

<div className='mb-16 md:mb-36 mx-auto w-2/3 md:w-5/6 lg:w-full'>
<div className='mb-16 md:mb-36 mx-auto w-full md:w-5/6 lg:w-full'>
<h3 className='text-white text-xl mb-4'>Used by</h3>

<div className='grid md:grid-cols-2 lg:grid-cols-4 gap-6 mx-auto items-center w-1/2 md:w-100'>
<div className='grid md:grid-cols-2 lg:grid-cols-4 gap-6 mx-auto items-center w-1/3 md:w-100'>
<img src='/img/logos/usedby/zapier-logo_white.png' className='w-40 mr-4' />
<img src='/img/logos/usedby/microsoft-white.png' className='w-40 mr-4' />
<img src='/img/logos/usedby/postman-white.png' className='w-40 mr-4' />
<img src='/img/logos/usedby/github-white.png' className='w-40' />
</div>
<p className='text-white my-8'>More than 200 implementations generating over 100 million weekly downloads</p>
<p className='text-white mx-4 my-8'>More than 200 implementations generating over 100 million weekly downloads</p>
</div>
</div>
</section>
Expand Down Expand Up @@ -211,16 +218,16 @@ const Home = (props: any) => {
<section className='lg:my-12 max-w-[1400px]'>
<div className='mb-12 md:w-3/4 mx-auto text-center'>
<h2 className='text-h3mobile md:text-h3 font-semibold mb-2'>Welcome to the JSON Schema Community</h2>
<p className='mx-4 md:w-3/4 md:mx-auto lg:text-h5'>With over 60 million weekly installs, JSON Schema has a large and active developer community across the world. Join the Community to learn, share ideas, ask questions, develop JSON Schema tooling and build new connections.
<p className='mx-6 md:w-3/4 md:mx-auto lg:text-h5'>With over 60 million weekly installs, JSON Schema has a large and active developer community across the world. Join the Community to learn, share ideas, ask questions, develop JSON Schema tooling and build new connections.
</p>
</div>
<div className='grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6 mb-12 mx-auto w-5/6'>
<div className='grid grid-cols-1 lg:grid-cols-3 gap-6 mb-12 mx-auto w-5/6 md:w-3/5 lg:w-5/6'>
<div className='w-full mb-6'>
<h3 className='mb-4 font-semibold' >Join the JSON Schema Community Slack!</h3>
<img src='/img/home-page/slack-json-schema.png' className='w-full mb-4' />
{/* <h3 className='mb-4 font-semibold' >Event</h3> */}
<p className='mb-4'>Join our Slack to ask questions, get feedback on your projects, and connect with +5000 practitioners and experts.</p>
<button className='w-full lg:w-1/2 rounded border-2 bg-primary text-white h-[40px] '><a href='https://json-schema.org/slack'>Join us</a></button>
<button className='w-full lg:w-1/2 rounded border-2 bg-primary text-white h-[40px] '><a href='https://json-schema.slack.com/join/shared_invite/zt-1ywpdj4yd-bXiBLjYEbKWUjzon0qiY9Q#/shared-invite/email'>Join us</a></button>
</div>
{/* BlogPost Data */}
<div className='w-full '>
Expand All @@ -247,7 +254,7 @@ const Home = (props: any) => {
</Link>
</div>
</div>
<div className=' '>
<div>
<div className='md:w-full mb-6 mr-4'>
<h3 className='mb-2 font-semibold' >JSON Schema Community Meetings & Events</h3>
<p className='mb-4'>We hold monthly Office Hours and weekly Open Community Working Meetings. Office Hours are every first Tuesday of the month at 15:00 BST, and by appointment. Open Community Working Meetings are every Monday at 14:00 PT.
Expand All @@ -258,7 +265,7 @@ const Home = (props: any) => {
>Office Hours</a></button>
</div>
</div>
<div>
<div >
<div>
<Headline4 >
Upcoming events
Expand All @@ -273,7 +280,7 @@ const Home = (props: any) => {
</p>
<div>
<p className=''>{event.title}</p>
<p>{event.time}</p>
<p>{event.time} {event.timezone}</p>
</div>
</div>
</li>
Expand Down Expand Up @@ -320,12 +327,11 @@ const Home = (props: any) => {
<section className='my-20'>
<div className='text-center mb-12'>
<h2 className='text-h3mobile md:text-h3 font-semibold mb-4'>Supported by</h2>
<p className='w-1/2 mx-auto'>The following companies support us by letting us use their products. <a href='mailto:[email protected]' className='border-b border-black'>Email us</a> for more info.</p>
<p className='px-4 md:w-1/2 mx-auto'>The following companies support us by letting us use their products.<br /><a href='mailto:[email protected]' className='border-b border-black'>Email us</a> for more info.</p>
</div>
<div className='grid grid-cols-2 md:gap-24 items-center mx-auto w-3/4 md:w-3/5 lg:w-1/2'>
<a href='https://orbit.love/' className='w-44'><img src='/img/logos/supported/orbit-logo-color.png' /></a>
<a href='https://json-schema.org/slack' className='w-44'><img src='/img/logos/supported/slack-logo.svg' /></a>

<div className='flex justify-center items-center'>
<a href='https://orbit.love/' ><img src='/img/logos/supported/orbit-logo-color.png' className='w-44 mr-8' /></a>
<a href='https://json-schema.slack.com/join/shared_invite/zt-1ywpdj4yd-bXiBLjYEbKWUjzon0qiY9Q#/shared-invite/email' ><img src='/img/logos/supported/slack-logo.svg' className='w-44 ml-8' /></a>
</div>
</section>
</div>
Expand All @@ -334,4 +340,4 @@ const Home = (props: any) => {
}

export default Home
Home.getLayout = getLayout
Home.getLayout = getLayout
Loading