Skip to content

Commit 9022f38

Browse files
fix: migrate Support component to tailwind css #8047 (#8083)
1 parent c8253ec commit 9022f38

2 files changed

Lines changed: 20 additions & 103 deletions

File tree

src/components/Support/Support.jsx

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,6 @@ import Additional from "./AdditionalSupporters.mjs";
99
/* eslint import/no-unresolved: ["error", { ignore: ["_supporters\.json$"] }] */
1010
import Backers from "./_supporters.json";
1111

12-
// Load Styling
13-
import "./Support.scss";
14-
1512
const SUPPORTERS = [...Backers];
1613

1714
// Merge or add additional backers/sponsors
@@ -88,6 +85,16 @@ function formatMoney(number) {
8885
return Math.round(number).toLocaleString("en-US");
8986
}
9087

88+
const AVATAR_CLASSES = {
89+
backer:
90+
"inline-block w-[31px] h-[31px] rounded-full border border-white shadow-[0_0_0_1px_rgb(112,202,10)] overflow-hidden align-middle",
91+
latest: "max-h-16 max-w-48 align-middle",
92+
bronze: "max-h-8 max-w-24 align-middle",
93+
silver: "max-h-16 max-w-48 align-middle",
94+
gold: "max-h-24 max-w-72 align-middle",
95+
platinum: "max-h-32 max-w-full min-[400px]:max-w-96 align-middle",
96+
};
97+
9198
export default class Support extends Component {
9299
static propTypes = {
93100
rank: PropTypes.string,
@@ -198,8 +205,11 @@ export default class Support extends Component {
198205
type === "monthly" ? "Monthly " : ""
199206
}Sponsors`}
200207
</h2>
201-
<div ref={(el) => (this.containerRef = el)} className="support">
202-
<div className="support__description">
208+
<div
209+
ref={(el) => (this.containerRef = el)}
210+
className="flex flex-wrap justify-center px-2 pb-4"
211+
>
212+
<div className="w-full mb-4">
203213
{rank === "backer" ? (
204214
<p>
205215
The following <b>Backers</b> are individuals who have
@@ -216,7 +226,7 @@ export default class Support extends Component {
216226
</p>
217227
) : (
218228
<p>
219-
<b className="support__rank">
229+
<b className="capitalize mr-1">
220230
{type === "monthly" ? `${rank} monthly` : rank} sponsors
221231
</b>
222232
{type === "monthly" ? (
@@ -246,7 +256,7 @@ export default class Support extends Component {
246256
} ($${formatMoney(supporter.monthlyDonations / 100)} monthly)`}
247257
>
248258
<a
249-
className="support__item"
259+
className="relative mx-0.5 mb-0.5 dark:bg-white"
250260
target="_blank"
251261
rel="noopener noreferrer nofollow"
252262
href={
@@ -256,7 +266,7 @@ export default class Support extends Component {
256266
>
257267
{
258268
<img
259-
className={`support__${rank}-avatar`}
269+
className={AVATAR_CLASSES[rank]}
260270
src={
261271
inView && supporter.avatar ? supporter.avatar : SmallIcon
262272
}
@@ -273,9 +283,9 @@ export default class Support extends Component {
273283
</Tooltip>
274284
))}
275285

276-
<div className="support__bottom">
286+
<div className="w-full mt-4">
277287
<a
278-
className="support__button"
288+
className="inline-block py-[0.4em] px-[1em] uppercase text-[#175d96] border border-[#175d96] rounded-4xl transition-all duration-[250ms] hover:bg-[#175d96] hover:text-white"
279289
href="https://opencollective.com/webpack#support"
280290
>
281291
Become a {rank === "backer" ? "backer" : "sponsor"}

src/components/Support/Support.scss

Lines changed: 0 additions & 93 deletions
This file was deleted.

0 commit comments

Comments
 (0)