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

[WIP] 414986 update theme and readme #6

Merged
merged 55 commits into from
Jan 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
78da05d
Improve theme excel format
FelipeSimoes Jan 5, 2024
058774e
#theme
FelipeSimoes Jan 8, 2024
3ebab79
Merge branch 'main' into 414986-theme-readme
FelipeSimoes Jan 8, 2024
05c52e9
Comparition
FelipeSimoes Jan 8, 2024
6f29c2a
Comparition
FelipeSimoes Jan 8, 2024
f239400
Comparition
FelipeSimoes Jan 8, 2024
45e79ea
Comparition
FelipeSimoes Jan 8, 2024
a2a2830
Comparition
FelipeSimoes Jan 8, 2024
6651fab
Comparition
FelipeSimoes Jan 8, 2024
58aa66c
Comparition
FelipeSimoes Jan 8, 2024
404d314
await
FelipeSimoes Jan 9, 2024
84ae111
await
FelipeSimoes Jan 9, 2024
62b7367
await
FelipeSimoes Jan 9, 2024
bb09e58
#414986 > using on load
FelipeSimoes Jan 9, 2024
4f8f3ac
#414986 > using on load
FelipeSimoes Jan 9, 2024
d19e0f5
#414986 > using on load
FelipeSimoes Jan 9, 2024
9354d46
#414986 > using on load
FelipeSimoes Jan 9, 2024
6212bf1
#414986 > using on load
FelipeSimoes Jan 9, 2024
08a9950
#414986 > using on load
FelipeSimoes Jan 9, 2024
0f1c5b7
#414986 > using on load
FelipeSimoes Jan 9, 2024
d0fd0c5
#414986 > using on load
FelipeSimoes Jan 9, 2024
d4ccf4f
#414986 > await and on load
FelipeSimoes Jan 9, 2024
8ccea5b
#414986 > await and on load
FelipeSimoes Jan 9, 2024
057c6f1
#414986 > regular loading
FelipeSimoes Jan 9, 2024
95443f1
#414986 > regular loading
FelipeSimoes Jan 9, 2024
282e29b
#414986 > regular loading
FelipeSimoes Jan 9, 2024
8031bdf
#414986 > regular loading
FelipeSimoes Jan 9, 2024
786698a
#414986 > docs
FelipeSimoes Jan 9, 2024
d5210d5
Add docs
FelipeSimoes Jan 9, 2024
fa4f23d
Add docs
FelipeSimoes Jan 9, 2024
46398ab
Add docs
FelipeSimoes Jan 9, 2024
edeceb5
Add docs
FelipeSimoes Jan 9, 2024
3f8b97e
Add docs
FelipeSimoes Jan 9, 2024
a9ff82c
Add docs
FelipeSimoes Jan 9, 2024
11eca74
#414986 > param set
FelipeSimoes Jan 9, 2024
3810573
#414986 > param set
FelipeSimoes Jan 9, 2024
5c55c53
Preview mobile param
FelipeSimoes Jan 9, 2024
9e6cda1
Preview mobile param
FelipeSimoes Jan 9, 2024
14695aa
Preview mobile param
FelipeSimoes Jan 9, 2024
87b1cb6
Preview mobile param
FelipeSimoes Jan 9, 2024
cdf1851
Preview mobile param
FelipeSimoes Jan 9, 2024
219c403
Preview mobile param
FelipeSimoes Jan 9, 2024
02a60de
Preview mobile param
FelipeSimoes Jan 9, 2024
60d69c1
Preview mobile param
FelipeSimoes Jan 9, 2024
cdaa5be
Preview mobile param
FelipeSimoes Jan 9, 2024
fea62bd
Preview mobile param
FelipeSimoes Jan 9, 2024
1d23f91
Preview mobile param
FelipeSimoes Jan 9, 2024
f90ec28
Preview mobile param
FelipeSimoes Jan 9, 2024
5ead37a
Preview mobile param
FelipeSimoes Jan 9, 2024
55f71e5
Preview mobile param
FelipeSimoes Jan 9, 2024
5747cef
Preview mobile param
FelipeSimoes Jan 9, 2024
c85bf9b
Preview mobile param
FelipeSimoes Jan 10, 2024
f152bb0
Example
FelipeSimoes Jan 10, 2024
3a729dd
Button
FelipeSimoes Jan 10, 2024
35cdaef
lint
FelipeSimoes Jan 10, 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
24 changes: 24 additions & 0 deletions blocks/breadcrumbs/breadcrumbs.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
raqn-breadcrumbs {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
gap: 10px;
align-items: center;
padding: 10px 0;

ul {
list-style: none;
padding: 0;
margin: 0;
display: flex;

li {
margin-inline-end: 1em;
font-weight: bold;

a {
color: var(--scope-color);
font-weight: normal;
}
}
}
}
30 changes: 30 additions & 0 deletions blocks/breadcrumbs/breadcrumbs.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import ComponentBase from '../../scripts/component-base.js';

export default class BreadCrumbs extends ComponentBase {
capitalize(string) {
return string
.split('-')
.map((str) => str.charAt(0).toUpperCase() + str.slice(1))
.join(' ');
}

ready() {
this.path = window.location.pathname.split('/');
this.classList.add('breadcrumbs');
this.innerHTML = `
<ul>
${this.path
.map((path, index) => {
if (path === '') {
return `<li><a href="/${path}">Home</a></li>`;
}
if (index === this.path.length - 1) {
return `<li>${this.capitalize(path)}</li>`;
}
const href = this.path.slice(0, index + 1).join('/');
return `<li><a href="${href}">${this.capitalize(path)}</a></li>`;
})
.join('<li class="separator">›</li>')}
<ul>`;
}
}
8 changes: 6 additions & 2 deletions blocks/button/button.css
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
raqn-button {
width: 100%;
display: grid;
align-content: center;
justify-content: center;
align-items: center;
justify-items: var(--scope-justify, start);

& > div {
& > * {
background-color: var(--scope-accent-background, #000);
color: var(--scope-accent-color, #fff);
text-transform: none;
Expand All @@ -19,7 +23,7 @@ raqn-button {
}

raqn-button a {
color: currentcolor;
color: var(--scope-accent-color, currentcolor);
padding: 10px 20px;
text-decoration: none;
}
Expand Down
43 changes: 37 additions & 6 deletions blocks/card/card.css
Original file line number Diff line number Diff line change
@@ -1,10 +1,41 @@
raqn-card {
background-color: var(--scope-background, red);
display: grid;
grid-template-columns: var(--card-columns, 1fr);
gap: var(--scope-gap, 20px);
background-color: var(--scope-background, red);
display: grid;
position: relative;
grid-template-columns: var(--card-columns, 1fr);
gap: var(--scope-gap, 20px);
padding: var(--scope-padding, 20px 0);
}

raqn-card a {
font-size: var(--raqn-font-size-3, 1.2em);
font-weight: bold;
}

raqn-card > picture {
grid-column: span var(--card-columns, 1fr);
}
grid-column: span var(--card-columns, 1fr);
}

raqn-card > div {
position: relative;
}

raqn-card:not(.inner-background) > div {
background-color: var(--scope-background, #fff);
color: var(--scope-color, #000);
}

raqn-card > div div:last-child > a {
position: absolute;
inset-inline-start: 0;
inset-block-start: 0;
width: 100%;
height: 100%;
cursor: pointer;
text-indent: -10000px;
}

raqn-card raqn-icon {
width: 100%;
display: flex;
}
32 changes: 16 additions & 16 deletions blocks/card/card.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,32 @@ import { eagerImage } from '../../scripts/libs.js';

export default class Card extends ComponentBase {
static get observedAttributes() {
return ['columns', 'ratio', 'eager'];
return ['columns', 'ratio', 'eager', 'background', 'button'];
}

connected() {
if (this.getAttribute('button') === 'true') {
Array.from(this.querySelectorAll('a')).forEach((a) =>
this.convertLink(a),
);
}
this.eager = parseInt(this.getAttribute('eager') || 0, 10);
this.ratio = this.getAttribute('ratio') || '4/3';
this.style.setProperty('--card-ratio', this.ratio);
this.classList.add('inner');
this.setupColumns(this.getAttribute('columns'));
if (this.eager) {
eagerImage(this, this.eager);
}
}

convertLink(a) {
const button = document.createElement('raqn-button');
const content = a.outerHTML;
button.innerHTML = content;
a.replaceWith(button);
}

setupColumns(columns) {
if (!columns) {
return;
Expand All @@ -24,19 +39,4 @@ export default class Card extends ComponentBase {
.join(' ');
this.style.setProperty('--card-columns', this.area);
}

attributeChangedCallback(name, oldValue, newValue) {
if (oldValue !== newValue) {
switch (name) {
case 'columns':
this.setupColumns(newValue);
break;
case 'ratio':
this.style.setProperty('--card-ratio', newValue);
break;
default:
break;
}
}
}
}
42 changes: 33 additions & 9 deletions blocks/footer/footer.css
Original file line number Diff line number Diff line change
@@ -1,14 +1,38 @@
footer {
padding: 2rem;
background-color: var(--overlay-background-color);
font-size: var(--body-font-size-s);
background-color: var(--scope-background-color);
width: var(--scope-max-width);
margin: 0 auto;
}

footer .footer {
max-width: 1200px;
margin: auto;
}
raqn-footer {
background-color: var(--scope-background-color);
border-top: 1px solid var(--scope-color);
display: grid;
grid-template-columns: auto 20vw;

& :last-child {
justify-self: end;
align-self: center;
}

ul {
list-style: none;
padding: 0;
margin: 0;
display: flex;

li {
margin: 2em 0;

a {
padding: 10px 1.2em;
color: var(--scope-color);
border-inline-end: 1px solid var(--scope-color);
}

footer .footer p {
margin: 0;
&:last-child a {
border-inline-end: none;
}
}
}
}
8 changes: 8 additions & 0 deletions blocks/footer/footer.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,12 @@ export default class Footer extends ComponentBase {
super();
this.external = '/footer.plain.html';
}

ready() {
const child = this.children[0];
child.replaceWith(...child.children);
this.nav = this.querySelector('ul');
this.nav.setAttribute('role', 'navigation');
this.classList.add('full-width');
}
}
24 changes: 12 additions & 12 deletions blocks/hero/hero.css
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
/* block specific CSS goes here */

raqn-hero {
--raqn-background-color: var(--scope-background, transparent);
--raqn-color: var(--scope-color, transparent);
--raqn-grid-template-columns: 0.6fr 0.4fr;
--hero-background-color: var(--scope-background, black);
--hero-color: var(--scope-color, white);
--hero-grid-template-columns: 0.6fr 0.4fr;
--hero-hero-order: 0;
--hero-padding-block: 40px;

background-color: var(--raqn-background-color);
color: var(--raqn-color);
background-color: var(--hero-background-color);
color: var(--hero-color);
align-items: center;
grid-template-columns: var(--hero-grid-template-columns, 1fr);
padding-block: var(--hero-padding-block);

@media screen and (max-width: 768px) {
--raqn-grid-template-columns: 1fr;
--hero-grid-template-columns: 1fr;
}

grid-template-columns: var(--raqn-grid-template-columns, 1fr);

@media screen and (min-width: 768px) {
& > div:first-child {
max-width: 30vw;
}
& > div:first-child {
order: var(--hero-hero-order);
}
}
6 changes: 5 additions & 1 deletion blocks/hero/hero.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
import ComponentBase from '../../scripts/component-base.js';

export default class Hero extends ComponentBase {
get observedAttributes() {
return ['order'];
}

connected() {
const child = this.children[0];
child.replaceWith(...child.children);
this.classList.add('full-width');
this.setAttribute('role', 'banner');
this.setAttribute('aria-label', 'hero');
this.style.setProperty('--hero-columns', this.getAttribute('height'));
this.style.setProperty('--hero-hero-order', this.getAttribute('order'));
}
}
7 changes: 4 additions & 3 deletions blocks/icon/icon.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ raqn-icon {
display: inline-flex;
font-size: 1em;
line-height: 1em;
text-align: center;
min-width: var(--scope-icon-size, 1em);
min-height: var(--scope-icon-size, 1em);
text-align: center;
justify-content: var(--scope-icon-align, start);
text-transform: none;
vertical-align: middle;
-webkit-font-smoothing: antialiased;
Expand All @@ -13,8 +14,8 @@ raqn-icon {

raqn-icon svg {
display: inline-block;
max-height: 100%;
max-width: 100%;
max-width: var(--scope-icon-size, 1em);
max-height: var(--scope-icon-size, 1em);
fill: currentcolor;
overflow: hidden;
vertical-align: middle;
Expand Down
2 changes: 1 addition & 1 deletion blocks/icon/icon.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export default class Icon extends ComponentBase {
}

get iconUrl() {
return `assets/icons/${this.iconName}.svg`;
return `/assets/icons/${this.iconName}.svg`;
}

get cache() {
Expand Down
11 changes: 11 additions & 0 deletions blocks/navigation/navigation.css
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,17 @@ raqn-navigation {
padding: var(--padding-vertical, 20px) var(--padding-horizontal, 20px);
}

.level-2,
.level-2 > ul {
display: inline-flex;
flex-direction: column;
}

.level-2 > ul {
list-style: none;
padding: 0;
}

.level-1 > ul {
display: flex;
clip-path: inset(0% -100vw 100% -100vw);
Expand Down
2 changes: 1 addition & 1 deletion blocks/navigation/navigation.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export default class Navigation extends Column {
return button;
}

render() {
ready() {
this.list = this.querySelector('ul');
this.nav = document.createElement('nav');
this.nav.append(this.list);
Expand Down
Loading