Skip to content

Commit

Permalink
First commit frescopa
Browse files Browse the repository at this point in the history
  • Loading branch information
Ritwik Srivastava authored and Ritwik Srivastava committed Feb 28, 2025
1 parent 1bff48c commit 0054a33
Show file tree
Hide file tree
Showing 3 changed files with 153 additions and 19 deletions.
59 changes: 49 additions & 10 deletions blocks/cards/cards.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,64 @@
margin: 0;
padding: 0;
display: grid;
grid-template-columns: repeat(auto-fill, minmax(257px, 1fr));
grid-gap: 24px;
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
gap: 24px;
max-width: 1200px;
margin: 0 auto;
padding: 32px 16px;
}

.cards > ul > li {
border: 1px solid #dadada;
background-color: var(--background-color);
background-color: #fff;
border-radius: 16px;
transition: all 0.3s ease;
padding: 32px;
display: flex;
justify-content: center;
align-items: center;
aspect-ratio: 1;
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
}

.cards .cards-card-body {
margin: 16px;
.cards > ul > li:hover {
transform: translateY(-4px);
box-shadow: 0 8px 30px rgba(0, 0, 0, 0.1);
}

.cards .cards-card-image {
line-height: 0;
width: 100%;
height: 100%;
display: flex;
justify-content: center;
align-items: center;
}

.cards .cards-card-image picture {
width: 80%;
height: 80%;
display: block;
}

.cards > ul > li img {
.cards .cards-card-image img {
width: 100%;
aspect-ratio: 4 / 3;
object-fit: cover;
height: 100%;
object-fit: contain;
transition: transform 0.3s ease;
filter: invert(56%) sepia(14%) saturate(1741%) hue-rotate(327deg) brightness(97%) contrast(89%);
}

.cards > ul > li:hover .cards-card-image img {
transform: scale(1.1);
}

.cards-card-body {
display: none; /* Since there's no content in the body */
}

@media (min-width: 900px) {
.cards > ul {
grid-template-columns: repeat(4, 1fr);
padding: 48px 24px;
gap: 32px;
}
}
90 changes: 84 additions & 6 deletions blocks/columns/columns.css
Original file line number Diff line number Diff line change
@@ -1,10 +1,78 @@
.columns > div {
display: flex;
flex-direction: column;
gap: 24px;
margin: 0 auto;
max-width: 1200px;
padding: 32px 16px;
}

.columns .column {
display: flex;
flex-direction: column;
gap: 16px;
}

.columns img {
width: 100%;
height: auto;
border-radius: 12px;
transition: all 0.3s ease;
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.columns .columns-img-col {
max-width: 50%;
margin: 0 auto;
}

.columns .columns-img-col picture {
display: block;
width: 100%;
}

.columns .text-content {
padding: 16px 0;
display: flex;
flex-direction: column;
gap: 16px;
align-items: flex-start;
}

.columns h2, .columns h3 {
margin: 0;
font-size: 32px;
color: #2d2d2d;
font-weight: 600;
line-height: 1.2;
}

.columns p {
margin: 0;
font-size: 18px;
line-height: 1.6;
color: #666;
}

.columns .button-container {
margin-top: 8px;
}

.columns .button {
display: inline-block;
padding: 12px 32px;
background-color: #4169E1;
color: white;
text-decoration: none;
border-radius: 25px;
font-weight: 500;
transition: all 0.3s ease;
}

.columns .button:hover {
background-color: #3154b8;
transform: translateY(-2px);
box-shadow: 0 4px 12px rgba(65, 105, 225, 0.2);
}

.columns > div > div {
Expand All @@ -15,19 +83,29 @@
order: 0;
}

.columns > div > .columns-img-col img {
display: block;
}

@media (width >= 900px) {
.columns > div {
align-items: center;
flex-direction: unset;
gap: 24px;
gap: 48px;
padding: 48px 24px;
}

.columns > div > div {
flex: 1;
order: unset;
}

.columns > div > .columns-img-col {
flex: 0.5;
max-width: 50%;
}

.columns img:hover {
transform: scale(1.02);
box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
}

.columns h2, .columns h3 {
font-size: 36px;
}
}
23 changes: 20 additions & 3 deletions blocks/columns/columns.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,31 @@ export default function decorate(block) {
// setup image columns
[...block.children].forEach((row) => {
[...row.children].forEach((col) => {
col.classList.add('column');

Check failure on line 9 in blocks/columns/columns.js

View workflow job for this annotation

GitHub Actions / build

Trailing spaces not allowed
const pic = col.querySelector('picture');
if (pic) {
const picWrapper = pic.closest('div');
if (picWrapper && picWrapper.children.length === 1) {
// picture is only content in column
picWrapper.classList.add('columns-img-col');
if (picWrapper) {
col.classList.add('columns-img-col');
// Move picture out of text-content
if (picWrapper.classList.contains('text-content')) {
col.insertBefore(pic, picWrapper);
if (!picWrapper.children.length) {
picWrapper.remove();
}
}
}
}

Check failure on line 24 in blocks/columns/columns.js

View workflow job for this annotation

GitHub Actions / build

Trailing spaces not allowed
// Wrap text content
const textElements = [...col.children].filter(child => !child.querySelector('picture') && !child.classList.contains('text-content'));

Check failure on line 26 in blocks/columns/columns.js

View workflow job for this annotation

GitHub Actions / build

Expected parentheses around arrow function argument
if (textElements.length) {
const textWrapper = document.createElement('div');
textWrapper.classList.add('text-content');
textElements.forEach(el => textWrapper.appendChild(el));

Check failure on line 30 in blocks/columns/columns.js

View workflow job for this annotation

GitHub Actions / build

Expected parentheses around arrow function argument
col.appendChild(textWrapper);
}
});
});
}

0 comments on commit 0054a33

Please sign in to comment.