Skip to content

Commit

Permalink
Separate color picker as 2 components
Browse files Browse the repository at this point in the history
  • Loading branch information
pkong-ds committed May 27, 2024
1 parent 29346a6 commit 7dda611
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 23 deletions.
38 changes: 20 additions & 18 deletions src/pages/model/[model]/color/[color].astro
Original file line number Diff line number Diff line change
Expand Up @@ -147,24 +147,26 @@ if (deviceDetail == null) {
<div class="color-section">
<h3 class="color-section__heading">COLOR</h3>
<p class="color-section__description">{deviceDetail.color.name}</p>
<ul class="color-picker">
{
sameModelDevices.map((d) => (
<li class="color-picker-item-container">
<a
href={`/model/${targetModel}/color/${d.color.id}`}
style={{ backgroundColor: d.color.hexcode }}
class={`color-picker-item ${
d.color.id === targetColor
? "color-picker-item--selected"
: ""
}`}
data-tippy-content={d.color.name}
/>
</li>
))
}
</ul>
<div class="color-picker-scrollable">
<ul class="color-picker">
{
sameModelDevices.map((d) => (
<li class="color-picker-item-container">
<a
href={`/model/${targetModel}/color/${d.color.id}`}
style={{ backgroundColor: d.color.hexcode }}
class={`color-picker-item ${
d.color.id === targetColor
? "color-picker-item--selected"
: ""
}`}
data-tippy-content={d.color.name}
/>
</li>
))
}
</ul>
</div>
</div>
<button disabled class="generate-btn">Generate product mockups</button>
<button style="display:none" class="start-mockup-btn"
Expand Down
14 changes: 9 additions & 5 deletions src/styles/upload.css
Original file line number Diff line number Diff line change
Expand Up @@ -387,17 +387,21 @@ main {
background-image: url("/Images/droplet.svg");
}

.color-picker-scrollable {
margin: 0 0 8px 0;
overflow: scroll;
-ms-overflow-style: none;
scrollbar-width: none;
}

.color-picker {
list-style: none;
display: flex;
padding: 12px 0;
align-items: center;
margin: 0 0 8px 0;
overflow-x: scroll;
overflow-y: hidden;
-ms-overflow-style: none;
scrollbar-width: none;
margin: 0;
justify-content: center;
width: max-content;
}

.color-picker-item {
Expand Down

0 comments on commit 7dda611

Please sign in to comment.