Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
55 changes: 23 additions & 32 deletions src/css/welcome.scss
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ $breakpoint: 1060px;
.code-snippets-welcome {
padding: 25px;

h1 {
h2 {
font-size: 32px;
margin-block: 48px 32px;
}
Expand All @@ -25,7 +25,7 @@ $breakpoint: 1060px;
padding: 32px;
}

header {
.code-snippets-header-wrapper {
display: flex;
flex-flow: row;
justify-content: space-between;
Expand All @@ -35,7 +35,7 @@ $breakpoint: 1060px;
padding-block-end: 20px;
}

h2 {
h3 {
font-size: 18px;
margin: 0;
}
Expand Down Expand Up @@ -68,8 +68,9 @@ $breakpoint: 1060px;
.code-snippets-partners,
.code-snippets-articles {
display: flex;
flex-direction: row;;
flex-direction: row;
gap: 16px;
margin: 0;

figure {
margin: 0;
Expand All @@ -89,6 +90,7 @@ $breakpoint: 1060px;
background: #fff;
border-radius: 8px;
display: flex;
margin: 0;
flex-flow: column;
color: #2c3337;

Expand All @@ -99,7 +101,7 @@ $breakpoint: 1060px;
}

.code-snippets-partners {
header {
.code-snippets-header-wrapper {
display: flex;
flex-direction: row;
justify-content: space-between;
Expand All @@ -109,7 +111,7 @@ $breakpoint: 1060px;
}

.code-snippets-articles {
header {
.code-snippets-header-wrapper {
display: flex;
flex-direction: column;
align-items: flex-start;
Expand All @@ -122,7 +124,7 @@ $breakpoint: 1060px;
margin-block-start: auto;
}

h2 {
h3 {
font-size: 18px;
margin: 0;
}
Expand Down Expand Up @@ -154,21 +156,27 @@ $breakpoint: 1060px;
color: #2c3337;
padding-inline-end: 1em;

header {
border: 0;
margin: 0;
padding: 0;
h3 {
font-size: 16px;
display: flex;

&:not(:first-of-type) {
margin-block-start: 100px;
}

p {
span {
font-size: 14px;
font-weight: normal;
margin-inline-start: auto;
}
}

h3 {
font-size: 16px;
h4 {
font-size: 14px;
margin: 1em 0;
}

h4 {
h5 {
font-size: 12px;
text-transform: uppercase;
margin: 0 0 16px;
Expand All @@ -189,23 +197,6 @@ $breakpoint: 1060px;
gap: 10px;
}

> article::after {
border-block-end: 1px solid #666;
content: ' ';
display: block;
inline-size: 50%;
margin-block: 3em;
margin-inline: auto;
}

> article:last-child {
padding-block-end: 1px;

&::after {
border: 0;
}
}

$icon-colors: (
lightbulb #f1c40f,
chart-line #85144b,
Expand Down
29 changes: 15 additions & 14 deletions src/js/components/WelcomeMenu/Changelog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,30 +56,31 @@ const ChangelogSection: React.FC<ChangelogSectionProps> = ({ section, entries })

export const Changelog = () =>
<div className="code-snippets-changelog">
<header>
<h2>{__('Latest changes', 'code-snippets')}</h2>
<div className="code-snippets-header-wrapper">
<h3>{__('Latest changes', 'code-snippets')}</h3>
<a
href="https://wordpress.org/plugins/code-snippets/changelog"
className="button button-primary button-large"
target="_blank" rel="noreferrer"
>
{__('View changelog', 'code-snippets')}
</a>
</header>
</div>
<div className="code-snippets-changelog-entries">
{CHANGELOG_DATA?.map(({ version, date, entries }) =>
<Fragment key={version}>
<header>
{/* translators: %s: version number. */}
<h3>{sprintf(__('Version %s', 'code-snippets'), version)}</h3>
<p>{date}</p>
</header>
<article>
{CHANGELOG_SECTIONS.map(section =>
entries[section]
? <ChangelogSection key={section} section={section} entries={entries[section]} />
: null)}
</article>
<h3>
{sprintf(
/* translators: %s: version number. */
__('Version %s', 'code-snippets'),
version
)}
<span>{date}</span>
</h3>
{CHANGELOG_SECTIONS.map(section =>
entries[section]
? <ChangelogSection key={section} section={section} entries={entries[section]} />
: null)}
</Fragment>)}
</div>
</div>
42 changes: 21 additions & 21 deletions src/js/components/WelcomeMenu/WelcomeMenu.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { __ } from '@wordpress/i18n'
import { __, sprintf } from '@wordpress/i18n'
import React, { useState } from 'react'
import { Toolbar } from '../common/Toolbar'
import { Changelog } from './Changelog'
Expand All @@ -11,8 +11,8 @@ const HeroImage = () => {

return (
<div className="code-snippets-hero">
<header>
<h2>{DATA?.hero.name}</h2>
<div className="code-snippets-header-wrapper">
<h3>{DATA?.hero.name}</h3>
<a
className="button button-primary button-large"
href={DATA?.hero.follow_url}
Expand All @@ -21,7 +21,7 @@ const HeroImage = () => {
>
{__('Read more', 'code-snippets')}
</a>
</header>
</div>
<figure>
{!isImageLoaded && <div className="code-snippets-loading-spinner"></div>}
<img
Expand All @@ -40,21 +40,21 @@ interface PartnersProps {

const Partners: React.FC<PartnersProps> = ({ partners }) =>
<>
<h1>{__('Exclusive deals from our partners', 'code-snippets')}</h1>
<section className="code-snippets-partners">
<h2>{__('Exclusive deals from our partners', 'code-snippets')}</h2>
<ul className="code-snippets-partners">
{partners.map(({ title, follow_url, image_url }) =>
<article key={title} className="code-snippets-card">
<li key={title} className="code-snippets-card">
<figure>
<img src={image_url} alt={__('Partner image', 'code-snippets')} />
</figure>
<header>
<div className="code-snippets-header-wrapper">
<h3>{title}</h3>
<a href={follow_url} target="_blank" rel="noopener noreferrer">
<a href={follow_url} target="_blank" rel="noopener noreferrer" aria-label={sprintf( /* translators: %s: partner name. */ __('Visit %s', 'code-snippets'), title)}>
{__('Visit', 'code-snippets')}
</a>
</header>
</article>)}
</section>
</div>
</li>)}
</ul>
</>

interface ArticlesProps {
Expand All @@ -63,30 +63,30 @@ interface ArticlesProps {

const Articles: React.FC<ArticlesProps> = ({ articles }) =>
<>
<h1>{__('Helpful articles', 'code-snippets')}</h1>
<section className="code-snippets-articles">
<h2>{__('Helpful articles', 'code-snippets')}</h2>
<ul className="code-snippets-articles">
{articles.map(({ title, follow_url, image_url, description, category }) =>
<article key={title} className="code-snippets-card">
<li key={title} className="code-snippets-card">
<figure>
<img src={image_url} alt={__('Feature image', 'code-snippets')} />
</figure>
<header>
<div className="code-snippets-header-wrapper">
<p className="item-category">{category}</p>
<h2>{title}</h2>
<h3>{title}</h3>
<p className="item-description">{description}</p>
<a href={follow_url} className="button button-secondary" target="_blank" rel="noopener noreferrer">
{__('Read more', 'code-snippets')}
</a>
</header>
</article>)}
</section>
</div>
</li>)}
</ul>
</>

export const WelcomeMenu = () =>
<>
<Toolbar />
<div className="code-snippets-welcome">
<h1>{__('Resources and Updates', 'code-snippets')}</h1>
<h2>{__('Resources and Updates', 'code-snippets')}</h2>

<div className="code-snippets-updates">
<HeroImage />
Expand Down
Loading