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

[TITAN-293] feat: ✨ Added Promo section component to the Front Page #14

Merged
merged 18 commits into from
Apr 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
7285092
feat: :sparkles: Added Promo section component to the Front Page
alvarocavalcanti Apr 6, 2023
12866f9
feat: :sparkles: Added CTA to the PromoSection component
alvarocavalcanti Apr 7, 2023
10054be
refactor: :lipstick: Refactored button styling to the global scope
alvarocavalcanti Apr 7, 2023
a254175
refactor: :recycle: Using showCta flag instead of two props to displa…
alvarocavalcanti Apr 7, 2023
ca678fc
style: :recycle: Using the section style from the global scss
alvarocavalcanti Apr 7, 2023
a5b30d7
refactor: :recycle: Extracted CtaButton component into its own module
alvarocavalcanti Apr 7, 2023
23e81fe
refactor: :recycle: Moved showCta into the props of CtaButton
alvarocavalcanti Apr 11, 2023
d760ae7
refactor: :recycle: Lifted CtaButton state to PromoSection
alvarocavalcanti Apr 11, 2023
b61de62
feat: :sparkles: Added Promo section component to the Front Page
alvarocavalcanti Apr 6, 2023
42ee3bb
feat: :sparkles: Added CTA to the PromoSection component
alvarocavalcanti Apr 7, 2023
7fee864
refactor: :lipstick: Refactored button styling to the global scope
alvarocavalcanti Apr 7, 2023
34fcb48
refactor: :recycle: Using showCta flag instead of two props to displa…
alvarocavalcanti Apr 7, 2023
8c7d74a
style: :recycle: Using the section style from the global scss
alvarocavalcanti Apr 7, 2023
2c465d0
refactor: :recycle: Extracted CtaButton component into its own module
alvarocavalcanti Apr 7, 2023
72fd518
refactor: :recycle: Moved showCta into the props of CtaButton
alvarocavalcanti Apr 11, 2023
2b6149f
refactor: :recycle: Lifted CtaButton state to PromoSection
alvarocavalcanti Apr 11, 2023
6b863d0
Merge branch 'TITAN-293' of github.com:wpengine/atlas-shopify-bluepri…
alvarocavalcanti Apr 11, 2023
e9266d3
Merge branch 'main' of github.com:wpengine/atlas-shopify-blueprint in…
alvarocavalcanti Apr 11, 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
13 changes: 13 additions & 0 deletions components/CtaButton/CtaButton.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import Link from 'next/link';

const CtaButton = ({ctaLink = null, ctaLabel = null }) => {
return (
<div className='buttonContainer'>
<Link href={ctaLink}>
<a className='button'>{ctaLabel}</a>
</Link>
</div>
);
};

export default CtaButton;
1 change: 1 addition & 0 deletions components/CtaButton/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default as CtaButton } from './CtaButton.js';
4 changes: 2 additions & 2 deletions components/ProductCard/ProductCard.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ const ProductCard = ({ product }) => {
)}
</span>
</div>
<div className={styles.buttonContainer}>
<div className='buttonContainer'>
<Link href={productHref}>
<a className={styles.button}>View product</a>
<a className='button'>View product</a>
</Link>
</div>
</div>
Expand Down
16 changes: 0 additions & 16 deletions components/ProductCard/ProductCard.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -76,21 +76,5 @@
font-weight: 700;
margin-bottom: 1rem;
}

.buttonContainer {
.button {
margin: 0px 0.5rem;
background-color: var(--wpe--color--green);
text-decoration: none;
font-weight: 500;
padding: 1rem;
display: inline-block;
color: var(--wpe--color--white);
transition: all 0.5s;
&:hover {
background-color: var(--wpe--color--green);
}
}
}
}
}
9 changes: 3 additions & 6 deletions components/ProductSection/ProductSection.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
import classNames from 'classnames';
import styles from './ProductSection.module.scss';
import { ProductCard } from '../ProductCard';
import { Container } from '../Container';

const cx = classNames.bind(styles);

const ProductSection = ({ products, heading }) => {
return (
<div className={cx(['section', styles.component])}>
<div className={`section ${styles.component}`}>
<Container>
<h1>{heading}</h1>
<div className={cx(styles.section)}>
<h2>{heading}</h2>
<div className='section'>
{products?.map?.((product) => {
return <ProductCard key={product.id} product={product} />;
})}
Expand Down
23 changes: 23 additions & 0 deletions components/PromoSection/PromoSection.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { Container } from '../Container';
import { CtaButton } from '../CtaButton';
import styles from './PromoSection.module.scss';

const PromoSection = ({
showCta = false,
ctaLink = null,
ctaLabel = null,
title = null,
description = null
}) => {
return (
<div className={`section ${styles.component}`}>
<Container>
<h1 className={styles.title}>{title}</h1>
<div className={styles.description}>{description}</div>
{ showCta && <CtaButton ctaLink={ctaLink} ctaLabel={ctaLabel} /> }
</Container>
RossoMaguire marked this conversation as resolved.
Show resolved Hide resolved
</div>
);
};

export default PromoSection;
22 changes: 22 additions & 0 deletions components/PromoSection/PromoSection.module.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
.component {
@import 'styles/css-variables';

background-color: var(--wpe--color--grey);

h2 {
padding: 2em;
}

.title {
text-align: center;
font-size: 50px;
padding: 1em 0 0 0;
}

.description {
padding: 1rem 0;
text-align: center;
margin-top: auto;
width: 100%;
}
}
1 change: 1 addition & 0 deletions components/PromoSection/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default as PromoSection } from './PromoSection.js';
8 changes: 3 additions & 5 deletions components/TestimonialsSection/TestimonialsSection.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
import TestimonialCard from './TestimonialCard';
import { Container } from '../Container';
import classNames from 'classnames';
import styles from './TestimonialsSection.module.scss';

const cx = classNames.bind(styles);

const TestimonialsSection = () => {
return (
<div className={cx(['section', styles.component])}>
<div className={`section ${styles.component}`}>
<Container>
<h1>Customer Testimonials</h1>
<div className={cx(styles.section)}>
<h2>Customer Testimonials</h2>
<div className='section'>
<TestimonialCard
image='https://demo.studiopress.com/page-builder/spend/eso_spend_customer_testimonial_1.jpg'
blurb='I can sync all my BigCommerce products into WordPress and catch all updates automatically. Now I can create content in WordPress with BigCommerce products!'
Expand Down
1 change: 1 addition & 0 deletions components/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export { SearchInput } from './SearchInput';
export { SearchRecommendations } from './SearchRecommendations';
export { SearchResults } from './SearchResults';
export { SearchSection } from './SearchSection';
export { PromoSection } from './PromoSection';
export { SkipNavigationLink } from './SkipNavigationLink';
export { TestimonialsSection } from './TestimonialsSection';
export { Hero } from './Hero';
Expand Down
46 changes: 45 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions styles/global.scss
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,23 @@
margin: 0 auto;
text-align: center;
padding-bottom: 4em;
display: flex;
}

.buttonContainer {
.button {
margin: 0px 0.5rem;
background-color: var(--wpe--color--green);
text-decoration: none;
font-weight: 500;
padding: 1rem;
display: inline-block;
color: var(--wpe--color--white);
transition: all 0.5s;
&:hover {
background-color: var(--wpe--color--green);
}
}
}

.shop-grid {
Expand Down
10 changes: 7 additions & 3 deletions wp-templates/front-page.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
SEO,
ContentWrapper,
ProductSection,
PromoSection,
TestimonialsSection,
} from '../components';
import productsStub from '../data/stubs/products';
Expand Down Expand Up @@ -40,9 +41,12 @@ export default function Component(props) {
<ProductSection heading='Latest Products' products={latestProducts} />
<TestimonialsSection />
<ProductSection heading='On Sale' products={saleProducts} />
{/*
<div>promo banner</div>
*/}
<PromoSection
showCta
ctaLink='/about'
ctaLabel='About'
title='Promo Banners'
description='You can use this component to promote articles or specific products. And optionally add a CTA below.' />
</Main>
<Footer title={siteTitle} menuItems={footerMenu} />
</>
Expand Down