Skip to content

Commit a88cd0c

Browse files
committed
feat: change service cards mobile design
1 parent 7d2dca8 commit a88cd0c

File tree

4 files changed

+77
-80
lines changed

4 files changed

+77
-80
lines changed

apps/website/src/components/ServiceCard.astro

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ const { idx, title, content, styles, imgPath, imgAlt, iconPath, classNames } =
1919
<div
2020
class={classnames(
2121
`
22+
stacked-card
2223
animation-card
2324
rounded-2xl
2425
max-lg:col-span-6
@@ -40,7 +41,7 @@ const { idx, title, content, styles, imgPath, imgAlt, iconPath, classNames } =
4041
lg:p-12
4142
grid
4243
grid-cols-6
43-
grid-rows-[min-content_min-content_auto]
44+
pb-0
4445
gap-x-3
4546
gap-y-7
4647
lg:gap-x-7
@@ -53,23 +54,23 @@ const { idx, title, content, styles, imgPath, imgAlt, iconPath, classNames } =
5354
)}
5455
>
5556
<div
56-
class="col-span-6 grid gap-7 lg:grid-cols-2 lg:col-span-2 lg:items-start justify-between"
57+
class="col-span-6 grid max-lg:grid-rows-[min-content_min-content_auto] gap-7 lg:grid-cols-2 lg:col-span-2 lg:items-start justify-between"
5758
>
58-
<span class="flex gap-7">
59-
<img src={iconPath} class="lg:mt-[2px] h-12 w-12" />
59+
<span class="grid md:flex gap-7 items-center">
60+
<img src={iconPath} class="lg:mt-[2px] h-8 w-8 md:h-12 md:w-12" />
6061
<h4
6162
class="font-medium text-xl leading-[22px] md:text-[28px] md:leading-[30px] text-left"
6263
>
6364
{title}
6465
</h4>
6566
</span>
6667
<div
67-
class="flex flex-col justify-center col-span-6 row-start-3 lg:justify-start lg:col-span-1 lg:row-start-2"
68+
class="flex flex-col justify-center items-center row-start-3 lg:justify-start lg:col-span-1 lg:row-start-2"
6869
>
6970
<img src={imgPath} alt={imgAlt} />
7071
</div>
7172
<div
72-
class="flex flex-col lg:flex-col col-span-6 row-start-2 lg:col-span-1 lg:col-start-2 lg:row-span-2 [&_p]:text-base [&_p]:leading-4 lg:[&_p]:text-[22px] lg:[&_p]:leading-8 text-left"
73+
class="flex flex-col lg:flex-col row-start-2 lg:col-span-1 lg:col-start-2 lg:row-span-2 [&_p]:text-base [&_p]:leading-[26px] md:[&_p]:text-[22px] md:[&_p]:font-normal md:[&_p]:leading-8 text-left"
7374
set:html={content.html}
7475
/>
7576
</div>

apps/website/src/components/Services.astro

Lines changed: 3 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -30,20 +30,17 @@ for (const service of servicesCollection) {
3030
contentClassName={classNames(grid_classes, "!gap-y-0 lg:pt-12")}
3131
>
3232
<div
33-
class="grid gap-4 col-span-6 md:col-span-10 md:col-start-2 text-center font-bold justify-items-center"
33+
class="grid gap-4 col-span-6 md:col-span-10 md:col-start-2 md:text-center font-bold md:justify-items-center"
3434
>
3535
<Pill>What we can do for you</Pill>
3636
<h1
37-
class="text-[44px] leading-[48px] md:text-[74px] md:leading-[81px] font-medium tracking-tight mb-12 md:mb-18 lg:mb-24 text-[#3C3843]"
37+
class="text-[44px] leading-[48px] md:text-[74px] md:leading-[81px] font-medium tracking-tight mb-12 md:mb-[72px] lg:mb-24 text-[#3C3843]"
3838
>
3939
Discover our <span class="text-crocoder-green"> Services </span>
4040
</h1>
4141
</div>
4242
<div id="services-wrapper" class="col-span-6 md:col-span-12">
43-
<div
44-
id="animation-wrapper"
45-
class="animation-container max-lg:grid max-md:grid-cols-6 max-lg:grid-cols-12 max-lg:gap-7 lg:h-screen lg:overflow-y-scroll lg:relative"
46-
>
43+
<div id="animation-wrapper" class="animation-container relative">
4744
{
4845
services.map((value, idx) => (
4946
<ServiceCard
@@ -61,27 +58,3 @@ for (const service of servicesCollection) {
6158
<div id="end" class="absolute bottom-0"></div>
6259
</div>
6360
</Section>
64-
65-
<!-- <script is:inline>
66-
const container = document.querySelector(".animation-container");
67-
const cards = document.querySelectorAll(".animation-card");
68-
69-
// Get the initial positions of the cards
70-
const initialTopPositions = Array.from(cards).map((card) => card.offsetTop);
71-
72-
container.addEventListener("scroll", () => {
73-
const scrollTop = container.scrollTop;
74-
75-
// Adjust the position of each card based on the scroll position
76-
cards.forEach((card, index) => {
77-
const offset = initialTopPositions[index] - scrollTop;
78-
const maxOffset = 100 * index; // Allow each card to cover the previous one as it scrolls
79-
80-
if (offset < maxOffset) {
81-
card.style.transform = `translateY(${Math.min(offset, maxOffset)}px)`;
82-
} else {
83-
card.style.transform = `translateY(0px)`;
84-
}
85-
});
86-
});
87-
</script> -->

apps/website/src/content/services/lead-migrations-without-imacting-customers.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
title: "Lead migrations without impacting customers"
2+
title: "Lead Migrations Without Impacting Customers"
33
imgPath: "/pic-boy-schedule.png"
44
imgAlt: "Illustration of a video meeting with Crocoder team member"
55
idx: 1

apps/website/src/styles/main.css

Lines changed: 66 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -53,56 +53,79 @@ body:has(nav #nav-menu-toggle:checked) {
5353
margin-top: 2.4rem;
5454
}
5555

56-
.animation-container {
57-
overflow-y: scroll;
58-
background-color: #f0f0f0;
59-
position: relative;
60-
-ms-overflow-style: none;
61-
scrollbar-width: none;
62-
}
56+
@media (min-width: 1024px) {
57+
.animation-container {
58+
overflow-y: scroll;
59+
height: 100vh;
60+
-ms-overflow-style: none;
61+
scrollbar-width: none;
62+
}
6363

64-
.animation-container::-webkit-scrollbar {
65-
display: none;
66-
}
64+
.animation-container::-webkit-scrollbar {
65+
display: none;
66+
}
6767

68-
.animation-card {
69-
width: 100%;
70-
height: 100px;
71-
position: relative;
72-
z-index: 1;
73-
transition: transform 0.3s ease;
74-
}
68+
.animation-card {
69+
width: 100%;
70+
height: 100px;
71+
position: relative;
72+
z-index: 1;
73+
transition: transform 0.3s ease;
74+
}
7575

76-
.animation-card:nth-child(1) {
77-
position: sticky;
78-
top: 0;
79-
}
76+
.animation-card:nth-child(1) {
77+
position: sticky;
78+
top: 0;
79+
z-index: 1;
80+
}
8081

81-
.animation-card:nth-child(1) {
82-
position: sticky;
83-
top: 0;
84-
z-index: 1;
85-
}
82+
.animation-card:nth-child(2) {
83+
position: sticky;
84+
top: 120px;
85+
z-index: 2;
86+
}
8687

87-
.animation-card:nth-child(2) {
88-
position: sticky;
89-
top: 120px;
90-
z-index: 2;
91-
}
88+
.animation-card:nth-child(3) {
89+
position: sticky;
90+
top: 240px;
91+
z-index: 3;
92+
}
9293

93-
.animation-card:nth-child(3) {
94-
position: sticky;
95-
top: 240px;
96-
z-index: 3;
97-
}
94+
.animation-card:nth-child(4) {
95+
position: sticky;
96+
top: 360px;
97+
z-index: 4;
98+
height: 933px;
99+
}
98100

99-
.animation-card:nth-child(4) {
100-
position: sticky;
101-
top: 360px;
102-
z-index: 4;
103-
height: 933px;
101+
.animation-card:nth-child(4) > section {
102+
height: 933px;
103+
}
104104
}
105105

106-
.animation-card:nth-child(4) > section {
107-
height: 933px;
106+
@media not all and (min-width: 1024px) {
107+
.animation-container {
108+
height: 2540px;
109+
}
110+
111+
.stacked-card {
112+
position: absolute;
113+
height: 710px;
114+
}
115+
116+
.stacked-card:nth-child(1) {
117+
top: 0;
118+
}
119+
120+
.stacked-card:nth-child(2) {
121+
top: calc(710px - 100px);
122+
}
123+
124+
.stacked-card:nth-child(3) {
125+
top: calc(1420px - 200px);
126+
}
127+
128+
.stacked-card:nth-child(4) {
129+
top: calc(2130px - 300px);
130+
}
108131
}

0 commit comments

Comments
 (0)