Skip to content
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

Experiment-driven Update: Quicklinks in header #6178

Merged
merged 11 commits into from
Oct 18, 2024
18 changes: 17 additions & 1 deletion website/src/components/hero/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import styles from './styles.module.css';

function Hero({ heading, subheading, showGraphic = false, customStyles = {}, classNames = '', colClassNames = '' }) {
function Hero({ heading, subheading, showGraphic = false, customStyles = {}, classNames = '', colClassNames = '', callToActionsTitle, callToActions = [] }) {
return (
<header className={` ${styles.Hero} container-fluid ${classNames ? classNames : ''}`} style={customStyles && customStyles}>
{showGraphic && (
Expand All @@ -12,6 +12,22 @@ function Hero({ heading, subheading, showGraphic = false, customStyles = {}, cla
<div className={`col col--7 ${colClassNames ? colClassNames : ''}`}>
<h1>{heading}</h1>
<p>{subheading}</p>
{callToActionsTitle && <span className={styles.callToActionsTitle}>{callToActionsTitle}</span>}
{callToActions.length > 0 && (
<div className={styles.callToActions}>
{callToActions.map((c, index) => (
c.href ? (
<a key={index} href={c.href} className={`${styles.callToAction}`}>
{c.label}
</a>
) : (
<a key={index} onClick={c.onClick} className={`${styles.callToAction}`}>
{c.title}
</a>
john-rock marked this conversation as resolved.
Show resolved Hide resolved
)
))}
</div>
)}
</div>
</div>
</div>
Expand Down
30 changes: 30 additions & 0 deletions website/src/components/hero/styles.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,33 @@
width: 60%;
}
}

.callToActionsTitle {
font-weight: bold;
margin-top: 20px;
margin-bottom: 20px;
font-size: 1.25rem;
display: block;
}

.callToActions {
display: flex;
flex-flow: wrap;
gap: 0.8rem;
justify-content: center;
}

.callToActions a {
outline: #fff solid 1px;
border-radius: 4px;
padding: 0 12px;
color: #fff;
transition: all .2s;
cursor: pointer;
}

.callToActions a:hover, .callToActions a:active, .callToActions a:focus {
text-decoration: none;
outline: rgb(4, 115, 119) solid 1px;
color: #fff;
}
33 changes: 31 additions & 2 deletions website/src/components/quickstartGuideList/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ function QuickstartList({ quickstartData }) {

// Update the URL with the new search parameters
history.replace({ search: params.toString() });
};
};

// Handle all filters
const handleDataFilter = () => {
Expand Down Expand Up @@ -98,6 +98,30 @@ function QuickstartList({ quickstartData }) {
handleDataFilter();
}, [selectedTags, selectedLevel, searchInput]); // Added searchInput to dependency array

// Set the featured guides that will show as CTAs in the hero section
// The value of the tag must match a tag in the frontmatter of the guides in order for the filter to apply after clicking
const featuredGuides = [
{
title: 'Quickstart Guides',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sugg sentence case

Suggested change
title: 'Quickstart Guides',
title: 'Quickstart guides',

value: 'Quickstart'
},
{
title: 'Use Jinja to improve your SQL code',
value: 'Jinja'
},
{
title: 'Orchestration',
value: 'Orchestration'
},
];

// Function to handle CTA clicks
const handleCallToActionClick = (value) => {
const params = new URLSearchParams(location.search);
params.set('tags', value);
history.replace({ search: params.toString() });
};

return (
<Layout>
<Head>
Expand All @@ -111,6 +135,11 @@ function QuickstartList({ quickstartData }) {
showGraphic={false}
customStyles={{ marginBottom: 0 }}
classNames={styles.quickstartHero}
callToActions={featuredGuides.map(guide => ({
title: guide.title,
onClick: () => handleCallToActionClick(guide.value)
}))}
callToActionsTitle={'Popular guides'}
john-rock marked this conversation as resolved.
Show resolved Hide resolved
/>
<section id='quickstart-card-section'>
<div className={`container ${styles.quickstartFilterContainer} `}>
Expand All @@ -135,7 +164,7 @@ function QuickstartList({ quickstartData }) {
</div>
</section>
</Layout>
)
);
}

export default QuickstartList;
Loading