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 3 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
4 changes: 2 additions & 2 deletions components/ProductCard/ProductCard.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,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>
RossoMaguire marked this conversation as resolved.
Show resolved Hide resolved
</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 @@ -74,21 +74,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);
}
}
}
}
}
30 changes: 30 additions & 0 deletions components/PromoSection/PromoSection.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import { Container } from '../Container';
import classNames from 'classnames';
import styles from './PromoSection.module.scss';
import Link from 'next/link';

const cx = classNames.bind(styles);
RossoMaguire marked this conversation as resolved.
Show resolved Hide resolved

const Cta = ({ ctaLink = null, ctaLabel = null }) => {
return (ctaLink && ctaLabel) ? (
<div className={'buttonContainer'}>
<Link href={ctaLink}>
<a className={'button'}>{`${ctaLabel}`}</a>
</Link>
</div>
) : null;
};

const PromoSection = ({ ctaLink = null, ctaLabel = null }) => {
return (
<div className={`section ${styles.component}`}>
<Container>
<h1 className={cx(styles.title)}>Promo Banners</h1>
<div className={cx(styles.description)}>You can use this component to promote articles or specific products. And optionally add a CTA below.</div>
<Cta ctaLink={ctaLink} ctaLabel={ctaLabel} />
</Container>
RossoMaguire marked this conversation as resolved.
Show resolved Hide resolved
</div>
);
};

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

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

h2 {
padding: 2em;
}

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

.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';
1 change: 1 addition & 0 deletions components/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export { NavigationMenu } from './NavigationMenu';
export { PostInfo } from './PostInfo';
export { ProductCard } from './ProductCard';
export { ProductSection } from './ProductSection';
export { PromoSection } from './PromoSection';
export { SkipNavigationLink } from './SkipNavigationLink';
export { TestimonialsSection } from './TestimonialsSection';
export { Hero } from './Hero';
Expand Down
17 changes: 17 additions & 0 deletions styles/global.scss
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,21 @@
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);
}
}
}
5 changes: 2 additions & 3 deletions wp-templates/front-page.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
TestimonialsSection,
} from '../components';
import productsStub from '../data/stubs/products';
import { PromoSection } from '../components/PromoSection';
RossoMaguire marked this conversation as resolved.
Show resolved Hide resolved

export default function Component(props) {
const { title: siteTitle, description: siteDescription } =
Expand Down Expand Up @@ -40,9 +41,7 @@ export default function Component(props) {
<ProductSection heading='Latest Products' products={latestProducts} />
<TestimonialsSection />
<ProductSection heading='On Sale' products={saleProducts} />
{/*
<div>promo banner</div>
*/}
<PromoSection ctaLink={'/about'} ctaLabel={'About'}/>
alvarocavalcanti marked this conversation as resolved.
Show resolved Hide resolved
</Main>
<Footer title={siteTitle} menuItems={footerMenu} />
</>
Expand Down