Skip to content

Feat/newsletter #681

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

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
a474003
docs: added definition of json hyper-schema
Akshaybagai52 Mar 1, 2024
99f0d2a
fixed
Akshaybagai52 Mar 3, 2024
50f7bed
Merge branch 'json-schema-org:main' into main
Akshaybagai52 Mar 3, 2024
7b872a6
Merge branch 'json-schema-org:main' into main
Akshaybagai52 Mar 6, 2024
a6bfddf
Merge branch 'json-schema-org:main' into main
Akshaybagai52 Mar 6, 2024
75029f6
Merge branch 'json-schema-org:main' into main
Akshaybagai52 Mar 6, 2024
7c5c331
Standardize List Display with Card Component (#433) (#460)
Michael-Obele Mar 11, 2024
3c3c5f6
feat: added Faq section (#534)
Akshaybagai52 Mar 16, 2024
46a922b
Fix faq
benjagm Mar 20, 2024
ee6bfdf
Added Case Studies page in Overview Section (#473)
TamannaVerma99 Mar 20, 2024
023a3c0
feat: added resource section (#509)
Akshaybagai52 Mar 20, 2024
8cb617e
Feat: Add the Newsletter feature to the website. (#489)
ayushnau Mar 20, 2024
8a32db3
Added welcome page (#566)
TamannaVerma99 Mar 21, 2024
af2660b
Merge remote-tracking branch 'upstream/web-release-3' into fix/spacing
Akshaybagai52 Mar 21, 2024
dddb77e
fix: spacing b/w buttons
Akshaybagai52 Mar 21, 2024
1649e7c
fix: added spacing in mobile design
Akshaybagai52 Mar 21, 2024
0a56013
fix: spacing on tablet screen
Akshaybagai52 Mar 22, 2024
ef5c524
fix: spacing on less than 300px screen
Akshaybagai52 Mar 25, 2024
3647457
Added Use-cases page (#589)
VivekJaiswal18 Apr 8, 2024
2cda0bc
Change docs link
benjagm Apr 8, 2024
f45b548
fix: spacing between buttons (#575)
Akshaybagai52 Apr 8, 2024
3b99a12
Merge remote-tracking branch 'upstream/web-release-3' into fix/spacing
Akshaybagai52 Apr 11, 2024
a22a799
community-page (#646)
officeneerajsaini Apr 15, 2024
abbcc0a
Merge branch 'main' into web-release-3
benjagm Apr 15, 2024
fb98b60
Update Sidebar.tsx
benjagm Apr 15, 2024
3958b6d
Add resources file
benjagm Apr 15, 2024
c8599e0
Update Sidebar.tsx
benjagm Apr 15, 2024
373f64e
Update case-studies.json
benjagm Apr 15, 2024
f7e6fd5
Text colours for dark theme
benjagm Apr 15, 2024
7995844
New version of the implementers page
benjagm Apr 19, 2024
c491fe9
Merge remote-tracking branch 'upstream/web-release-3' into fix/spacing
Akshaybagai52 Apr 21, 2024
7f74fb7
feat: added roadmap page
Akshaybagai52 Apr 22, 2024
12ef98d
feat: added roadmap page
Akshaybagai52 Apr 22, 2024
c04d577
Feat: Replacing Axios to fs fetching in resources page (#657)
DhairyaMajmudar Apr 23, 2024
e888118
Merge remote-tracking branch 'upstream/web-release-3' into feat/newsl…
Akshaybagai52 Apr 28, 2024
e13fb09
feat: added previous newletter
Akshaybagai52 Apr 28, 2024
a897534
fix: updated
Akshaybagai52 Apr 28, 2024
9cf99f1
fix: updated
Akshaybagai52 Apr 28, 2024
65ae099
fix: updated
Akshaybagai52 Apr 28, 2024
41b4f40
changes
Akshaybagai52 May 28, 2024
89186f6
fixed
Akshaybagai52 May 28, 2024
1206e1b
merged
Akshaybagai52 May 28, 2024
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
38 changes: 0 additions & 38 deletions .github/workflows/greet_on_first_merge.yml

This file was deleted.

16 changes: 0 additions & 16 deletions CODEOWNERS

This file was deleted.

94 changes: 94 additions & 0 deletions components/Accordion.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
import React, { useState, useEffect } from 'react';
import { useRouter } from 'next/router';

interface AccordionItem {
question: string;
answer: string;
id: number;
}

interface AccordionProps {
items: AccordionItem[];
}

const Accordion: React.FC<AccordionProps> = ({ items }) => {
const [activeIndex, setActiveIndex] = useState<number | null>(null);
const router = useRouter();

const handleToggle = (index: number) => {
setActiveIndex((prevIndex) => (prevIndex === index ? null : index));
};

useEffect(() => {
const hash = router.asPath.split('#')[1];
if (hash) {
const id = parseInt(hash, 10);
const index = items.findIndex((item) => item.id === id);
if (index !== -1) {
setActiveIndex(index);

setTimeout(() => {
const element = document.getElementById(hash);
if (element) {
const navbarHeight = 150;
const offset = element.offsetTop - navbarHeight;
window.scrollTo({ top: offset, behavior: 'smooth' });
}
}, 0);
}
}
}, [items, router.asPath]);

const handleLinkClick = (id: number) => {
const index = items.findIndex((item) => item.id === id);
setActiveIndex(index);

const newUrl = `#${id}`;
router.push(newUrl, undefined, { shallow: true });
};

return (
<div>
{items.map((item, index) => (
<div
key={item.id || index}
className={`overflow-hidden transition-max-height border-t-2 ${
activeIndex === index ? 'max-h-96' : 'max-h-20'
} ${index === items.length - 1 ? 'border-b-2' : ''}`}
>
<div className='flex justify-between items-center p-4 cursor-pointer'>
<div className='text-[20px]'>
<a
href={`#${item.id}`}
onClick={(e) => {
e.preventDefault();
handleLinkClick(item.id);
}}
>
{item.question}
</a>
</div>
<div
className={`transform transition-transform text-[20px] ${
activeIndex === index ? 'rotate-45' : ''
}`}
onClick={() => handleToggle(index)}
>
&#43;
</div>
</div>
{activeIndex === index && (
<div
id={`${item.id}`}
className='p-2 text-gray-500 dark:text-slate-200'
>
{item.answer}
</div>
)}
</div>
))}
</div>
);
};

export default Accordion;
70 changes: 20 additions & 50 deletions components/CarbonsAds.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,6 @@
import React, { useEffect, useRef } from 'react';
import { useRouter } from 'next/router';

declare global {
interface Window {
_carbonads: {
refresh: () => void;
reload: (where: string, force_serve: boolean) => void;
remove: (el: HTMLElement) => void;
srv: () => void;
};
}
}

type Props = {
className?: string;
variant?: 'sidebar';
Expand All @@ -22,41 +11,28 @@ function CarbonAds({ className, variant = 'sidebar' }: Props) {
const router = useRouter();

useEffect(() => {
const mobileMediaQuery = window.matchMedia('(max-width: 1023px)');
if (!mobileMediaQuery.matches) {
const hasCarbonAds = document.querySelector('#carbonads');
// Check if another ad is present to refresh
if (hasCarbonAds) {
window._carbonads.refresh();
return;
} else {
// Check if the script is present (ad is not yet present) so that duplicate requests are not made to carbon ads
const hasCarbonAdsScript = document.querySelector('#_carbonads_js');
if (!hasCarbonAdsScript) {
const carbonAdsScript = document.createElement('script');
carbonAdsScript.id = '_carbonads_js';
carbonAdsScript.type = 'text/javascript';
carbonAdsScript.async = true;
document
.querySelector('#carbonads-container')
?.appendChild(carbonAdsScript);
carbonAdsScript.src = `//cdn.carbonads.com/carbon.js?serve=CE7I627Y&placement=json-schemaorg&rnd=${Math.random()}`;
}
}
const hasCarbonAdsScript = document.querySelector('#_carbonads_js');
if (!hasCarbonAdsScript) {
const carbonAdsScript = document.createElement('script');
carbonAdsScript.id = '_carbonads_js';
carbonAdsScript.type = 'text/javascript';
carbonAdsScript.async = true;
document
.querySelector('#carbonads-container')
?.appendChild(carbonAdsScript);
carbonAdsScript.src = `//cdn.carbonads.com/carbon.js?serve=CE7I627Y&placement=json-schemaorg&rnd=${Math.random()}`;
}

const existingStyleSheet = document.querySelector('#_carbonads_css');
if (existingStyleSheet) {
existingStyleSheet.innerHTML = CarbonAds.stylesheet[variant];
} else {
const carbonAdsStyleSheet = document.createElement('style');
carbonAdsStyleSheet.id = '_carbonads_css';
carbonAdsStyleSheet.innerHTML = CarbonAds.stylesheet[variant];
document
.querySelector('#carbonads-container')
?.appendChild(carbonAdsStyleSheet);
}
const existingStyleSheet = document.querySelector('#_carbonads_css');
if (existingStyleSheet) {
existingStyleSheet.innerHTML = CarbonAds.stylesheet[variant];
} else {
(carbonRef.current as HTMLElement).style.display = 'none';
const carbonAdsStyleSheet = document.createElement('style');
carbonAdsStyleSheet.id = '_carbonads_css';
carbonAdsStyleSheet.innerHTML = CarbonAds.stylesheet[variant];
document
.querySelector('#carbonads-container')
?.appendChild(carbonAdsStyleSheet);
}
}, [router.asPath]);

Expand Down Expand Up @@ -115,12 +91,6 @@ CarbonAds.stylesheet = {
margin-top: 4px;
color: rgb(100 116 139);
}

@media (max-width: 1023px) {
#carbonads-container {
display: none;
}
}
`,
};

Expand Down
91 changes: 91 additions & 0 deletions components/Card.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
import React from 'react';
import Link from 'next/link';
import TextTruncate from 'react-text-truncate';
interface CardProps {
title: string;
body: string;
icon?: string;
link?: string;
image?: string;
headerSize?: 'small' | 'medium' | 'large';
bodyTextSize?: 'small' | 'medium' | 'large';
}

const CardBody = ({
title,
body,
icon,
link,
image,
headerSize,
bodyTextSize,
}: CardProps) => {
const headerSizeClasses: Record<string, string> = {
small: 'text-[0.9rem]',
medium: 'text-[1.3rem]',
large: 'text-[2rem]',
};
const bodyTextSizeClasses: Record<string, string> = {
small: 'text-[0.85rem]',
medium: 'text-[1rem]',
large: 'text-[1.5rem]',
};
return (
<div className='group relative h-full w-full max-w-lg rounded-lg border border-gray-200 bg-white p-6 px-12 shadow-3xl transition-colors delay-[150ms] ease-in-out hover:bg-slate-100'>
<div className='flex justify-center '>
{image && <img src={image} className='h-32 p-2' />}
</div>
<div className='flex flex-row items-start mb-6'>
{icon && (
<span className='mr-6 flex h-14 w-14 flex-shrink-0 items-center justify-center rounded-lg border bg-blue-200 px-3 text-gray-900'>
<img src={icon} alt={title} className='h-full w-full' />
</span>
)}
<p
className={`mb-1 mt-1 items-center font-bold text-gray-900 ${headerSizeClasses[headerSize || 'medium']}`}
>
{title}
</p>
</div>
<hr className='mb-4 mt-3.5 h-px border-0 bg-gray-400' />
<p
className={`mb-8 dark:text-black mt-5 ${bodyTextSizeClasses[bodyTextSize || 'medium']} `}
>
<TextTruncate element='span' line={3} text={body} />
</p>
{link && (
<p className='absolute bottom-3 right-5 font-medium opacity-0 transition-opacity delay-150 ease-in-out group-hover:opacity-100 dark:text-black'>
Read More
</p>
)}
</div>
);
};

const Card: React.FC<CardProps> = ({
title,
body,
icon,
link,
image,
headerSize,
bodyTextSize,
}) => {
return (
<>
{link ? (
<Link href={link}>
<CardBody
{...{ title, body, icon, link, image, headerSize, bodyTextSize }}
/>
</Link>
) : (
<CardBody
{...{ title, body, icon, link, image, headerSize, bodyTextSize }}
/>
)}
</>
);
};

export default Card;
2 changes: 1 addition & 1 deletion components/DarkModeToggle.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export default function DarkModeToggle() {
return (
<button
onClick={toggleDarkMode}
className='dark-mode-toggle rounded-md dark:hover:bg-gray-700 p-1.5 hover:bg-gray-100 focus:bg-gray-100 focus:outline-none transition duration-150'
className='dark-mode-toggle min-w-[2rem] rounded-md dark:hover:bg-gray-700 md:p-1.5 pr-2 hover:bg-gray-100 focus:bg-gray-100 focus:outline-none transition duration-150'
disabled={!isClickable}
>
<img src={img} alt='Dark Mode' width={25} height={25} />
Expand Down
18 changes: 18 additions & 0 deletions components/Faq.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import React from 'react';
import faqData from '../data/faq.json';
import Accordion from '~/components/Accordion';

export default function Faq({ category }: { category: string }) {
const filteredFAQs = faqData.filter((item) => item.category === category);

return (
<section>
<div className='max-w-screen-md mx-auto p-8'>
<h2 className='text-2xl font-bold text-[24px] mb-4'>
{category.toUpperCase()}
</h2>
<Accordion items={filteredFAQs} />
</div>
</section>
);
}
Loading