Skip to content

Commit

Permalink
FEAT: responsive gradient when mobile
Browse files Browse the repository at this point in the history
  • Loading branch information
YeonSeong-Lee committed Apr 27, 2023
1 parent 43522bd commit d84d39b
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/component/Benefit/Benefit.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,18 @@
await img.decode();
const color = await colorThief.getColor(img, 25);
const invertedColor = color.map((c) => 255 - c);
let gradientPercent;
if (window.innerWidth <= 768){
gradientPercent = 42;
} else {
gradientPercent = 20;
}
const gradient = `linear-gradient(242deg ,
rgba(${invertedColor[0]}, ${invertedColor[1]}, ${invertedColor[2]}, 0.8) 0%,
rgba(0, 0, 0, 0.8) 20%)`;
rgba(0, 0, 0, 0.8) ${gradientPercent}%)`;
benefitComponent.style.backgroundImage = gradient;
};
/**
* @type {{companyName: string, companyDescription: string, logo: string, category: string, content: string, method: string[], startDate: string, endDate: string}}
*/
Expand Down

1 comment on commit d84d39b

@vercel
Copy link

@vercel vercel bot commented on d84d39b Apr 27, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.