Skip to content

Commit 8ef8dd2

Browse files
committed
[optimize] simplify CodeX codes
[fix] some CodeX bugs
1 parent 0211cca commit 8ef8dd2

16 files changed

Lines changed: 516 additions & 646 deletions

components/Activity/Hackathon/HackathonActionHub.module.less renamed to components/Activity/Hackathon/ActionHub.module.less

Lines changed: 7 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,22 @@
11
@import './theme.less';
22

33
.section {
4-
.section-shell();
54
padding-top: clamp(3rem, 5vw, 4rem);
65
}
76

87
.registerWrap {
98
display: grid;
109
grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr);
11-
gap: 1.5rem;
1210
align-items: start;
11+
gap: 1.5rem;
1312

1413
@media (max-width: 1199px) {
1514
grid-template-columns: 1fr;
1615
}
1716
}
1817

1918
.registerCard {
20-
.panel-card();
21-
background: linear-gradient(
22-
135deg,
23-
rgba(44, 232, 255, 0.08),
24-
rgba(123, 97, 255, 0.14)
25-
);
19+
background: linear-gradient(135deg, rgba(44, 232, 255, 0.08), rgba(123, 97, 255, 0.14));
2620
}
2721

2822
.registerCardInner,
@@ -33,17 +27,16 @@
3327
.regEyebrow,
3428
.entryEyebrow,
3529
.entryStep {
36-
.eyebrow();
3730
}
3831

3932
.regTitle,
4033
.entryTitle {
4134
margin: 0;
4235
color: #fff;
43-
font-family: @heading;
44-
font-size: clamp(1.55rem, 3vw, 2.1rem);
4536
font-weight: 800;
37+
font-size: clamp(1.55rem, 3vw, 2.1rem);
4638
line-height: 1.3;
39+
font-family: @heading;
4740
}
4841

4942
.regTitle {
@@ -68,12 +61,10 @@
6861
}
6962

7063
.actionButton {
71-
.button-primary();
7264
}
7365

7466
.actionButtonGhost,
7567
.entryLink {
76-
.button-ghost();
7768
}
7869

7970
.regFacts {
@@ -83,15 +74,13 @@
8374
margin: 1.3rem 0 0;
8475

8576
li {
86-
.chip();
8777
padding: 0.48rem 0.85rem;
8878
color: @copy;
8979
font-size: 0.9rem;
9080
}
9181
}
9282

9383
.entryHub {
94-
.panel-card();
9584
}
9685

9786
.entryHubHead {
@@ -104,9 +93,8 @@
10493
}
10594

10695
.entryCard {
107-
.panel-card();
108-
height: 100%;
10996
padding: 1.3rem;
97+
height: 100%;
11098
}
11199

112100
.entryStep {
@@ -116,8 +104,8 @@
116104
.entryCard h4 {
117105
margin: 0.55rem 0 0.45rem;
118106
color: #fff;
119-
font-family: @heading;
120107
font-size: 1.02rem;
108+
font-family: @heading;
121109
}
122110

123111
.entryCard p {
@@ -132,11 +120,10 @@
132120
}
133121

134122
.entryMeta {
135-
.chip();
136123
padding: 0.35rem 0.7rem;
137124
color: @gold;
138-
font-family: @heading;
139125
font-size: 0.72rem;
126+
font-family: @heading;
140127
letter-spacing: 0.06em;
141128
text-transform: uppercase;
142129
}

components/Activity/Hackathon/HackathonActionHub.tsx renamed to components/Activity/Hackathon/ActionHub.tsx

Lines changed: 9 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import type { FC, PropsWithChildren } from 'react';
22
import { Col, Container, Row } from 'react-bootstrap';
33

4-
import { HackathonHeroAction } from './HackathonHero';
5-
import styles from './HackathonActionHub.module.less';
4+
import { HackathonHeroAction } from './Hero';
5+
import styles from './ActionHub.module.less';
66

77
export interface HackathonActionHubEntry {
88
count: number;
@@ -27,20 +27,15 @@ export const HackathonActionHubLink: FC<{
2727
variant: 'ghost' | 'primary';
2828
}> = ({ action, variant }) => (
2929
<a
30-
className={
31-
variant === 'primary' ? styles.actionButton : styles.actionButtonGhost
32-
}
30+
className={variant === 'primary' ? styles.actionButton : styles.actionButtonGhost}
3331
href={action.href}
3432
{...(action.external && { target: '_blank', rel: 'noreferrer' })}
3533
>
3634
{action.label}
3735
</a>
3836
);
3937

40-
const ActionEntryCard: FC<{ entry: HackathonActionHubEntry; step: string }> = ({
41-
entry,
42-
step,
43-
}) => (
38+
const ActionEntryCard: FC<{ entry: HackathonActionHubEntry; step: string }> = ({ entry, step }) => (
4439
<article className={styles.entryCard}>
4540
<span className={styles.entryStep}>
4641
{step} · {entry.eyebrow}
@@ -54,7 +49,7 @@ const ActionEntryCard: FC<{ entry: HackathonActionHubEntry; step: string }> = ({
5449
</div>
5550

5651
<nav className={styles.entryLinks} aria-label={entry.title}>
57-
{entry.links.map((link) => (
52+
{entry.links.map(link => (
5853
<a
5954
key={`${link.label}-${link.href}`}
6055
className={styles.entryLink}
@@ -68,9 +63,7 @@ const ActionEntryCard: FC<{ entry: HackathonActionHubEntry; step: string }> = ({
6863
</article>
6964
);
7065

71-
export const HackathonActionHub: FC<
72-
PropsWithChildren<HackathonActionHubProps>
73-
> = ({
66+
export const HackathonActionHub: FC<PropsWithChildren<HackathonActionHubProps>> = ({
7467
children,
7568
entries,
7669
facts,
@@ -90,17 +83,12 @@ export const HackathonActionHub: FC<
9083
<p className={styles.regDesc}>{primaryDescription}</p>
9184

9285
<nav className={styles.regActions} aria-label={title}>
93-
{primaryAction && (
94-
<HackathonActionHubLink
95-
action={primaryAction}
96-
variant="primary"
97-
/>
98-
)}
86+
{primaryAction && <HackathonActionHubLink action={primaryAction} variant="primary" />}
9987
{children}
10088
</nav>
10189

10290
<ul className={`list-unstyled ${styles.regFacts}`}>
103-
{facts.map((fact) => (
91+
{facts.map(fact => (
10492
<li key={fact}>{fact}</li>
10593
))}
10694
</ul>
@@ -116,10 +104,7 @@ export const HackathonActionHub: FC<
116104
<Row as="ol" className="list-unstyled g-3 mb-0">
117105
{entries.map((entry, index) => (
118106
<Col as="li" key={entry.title} md={6}>
119-
<ActionEntryCard
120-
entry={entry}
121-
step={String(index + 1).padStart(2, '0')}
122-
/>
107+
<ActionEntryCard entry={entry} step={String(index + 1).padStart(2, '0')} />
123108
</Col>
124109
))}
125110
</Row>

components/Activity/Hackathon/HackathonAwards.module.less renamed to components/Activity/Hackathon/Awards.module.less

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
@import './theme.less';
22

3-
.section-frame();
4-
53
.supportEyebrow {
6-
.section-subtitle();
74
}
85

96
.awardsGrid {
@@ -13,7 +10,6 @@
1310
}
1411

1512
.badgeTile {
16-
.panel-card();
1713
overflow: hidden;
1814
}
1915

@@ -24,8 +20,8 @@
2420
.badgeArt {
2521
border-radius: 22px;
2622
background: rgba(255, 255, 255, 0.04);
27-
width: 100%;
2823
aspect-ratio: 1;
24+
width: 100%;
2925
object-fit: cover;
3026
}
3127

@@ -35,8 +31,8 @@
3531

3632
.badgeTierLabel {
3733
color: @gold;
38-
font-family: @heading;
3934
font-size: 0.74rem;
35+
font-family: @heading;
4036
letter-spacing: 0.08em;
4137
text-transform: uppercase;
4238
}
@@ -45,8 +41,8 @@
4541
.supportTitle {
4642
margin: 0;
4743
color: #fff;
48-
font-family: @heading;
4944
font-weight: 800;
45+
font-family: @heading;
5046
}
5147

5248
.badgeTileTitle {
@@ -71,8 +67,8 @@
7167
div {
7268
display: grid;
7369
grid-template-columns: auto 1fr;
74-
gap: 0.8rem;
7570
align-items: start;
71+
gap: 0.8rem;
7672
}
7773

7874
dt,
@@ -82,8 +78,8 @@
8278

8379
dt {
8480
color: @muted;
85-
font-family: @heading;
8681
font-size: 0.72rem;
82+
font-family: @heading;
8783
letter-spacing: 0.08em;
8884
text-transform: uppercase;
8985
}
@@ -95,7 +91,6 @@
9591
}
9692

9793
.supportCard {
98-
.panel-card();
9994
display: grid;
10095
grid-template-columns: minmax(0, 0.75fr) minmax(0, 1.25fr);
10196
gap: 1.25rem;
@@ -115,19 +110,19 @@
115110
.partnerGrid {
116111
display: grid;
117112
grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
118-
gap: 0.8rem;
119113
align-items: center;
114+
gap: 0.8rem;
120115
}
121116

122117
.partnerLink {
123118
display: flex;
124-
align-items: center;
125119
justify-content: center;
120+
align-items: center;
126121
border: 1px solid rgba(255, 255, 255, 0.08);
127122
border-radius: 20px;
128123
background: rgba(255, 255, 255, 0.04);
129-
min-height: 104px;
130124
padding: 1rem;
125+
min-height: 104px;
131126
}
132127

133128
.partnerLogo {

components/Activity/Hackathon/HackathonAwards.tsx renamed to components/Activity/Hackathon/Awards.tsx

Lines changed: 7 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { FC } from 'react';
33
import { Container } from 'react-bootstrap';
44

55
import { LarkImage } from '../../LarkImage';
6-
import styles from './HackathonAwards.module.less';
6+
import styles from './Awards.module.less';
77

88
export interface HackathonAwardsMeta<Value = string> {
99
label: string;
@@ -36,13 +36,7 @@ export interface HackathonAwardsProps {
3636
title: string;
3737
}
3838

39-
const PrizeCard: FC<HackathonPrizeItem> = ({
40-
description,
41-
image,
42-
meta,
43-
tier,
44-
title,
45-
}) => (
39+
const PrizeCard: FC<HackathonPrizeItem> = ({ description, image, meta, tier, title }) => (
4640
<article className={styles.badgeTile}>
4741
{image && (
4842
<div className={styles.badgeArtWrap}>
@@ -67,23 +61,11 @@ const PrizeCard: FC<HackathonPrizeItem> = ({
6761
</article>
6862
);
6963

70-
const OrganizationLogo: FC<HackathonOrganizationItem> = ({
71-
href,
72-
logo,
73-
name,
74-
}) => {
75-
const imageNode = (
76-
<LarkImage src={logo} alt={name} className={styles.partnerLogo} />
77-
);
64+
const OrganizationLogo: FC<HackathonOrganizationItem> = ({ href, logo, name }) => {
65+
const imageNode = <LarkImage src={logo} alt={name} className={styles.partnerLogo} />;
7866

7967
return href ? (
80-
<a
81-
href={href}
82-
target="_blank"
83-
rel="noreferrer"
84-
title={name}
85-
className={styles.partnerLink}
86-
>
68+
<a href={href} target="_blank" rel="noreferrer" title={name} className={styles.partnerLink}>
8769
{imageNode}
8870
</a>
8971
) : (
@@ -113,7 +95,7 @@ export const HackathonAwards: FC<HackathonAwardsProps> = ({
11395
</header>
11496

11597
<div className={styles.awardsGrid}>
116-
{prizes.map((prize) => (
98+
{prizes.map(prize => (
11799
<PrizeCard key={prize.id} {...prize} />
118100
))}
119101
</div>
@@ -129,7 +111,7 @@ export const HackathonAwards: FC<HackathonAwardsProps> = ({
129111
</div>
130112

131113
<nav className={styles.partnerGrid} aria-label={supportEyebrow}>
132-
{organizations.map((organization) => (
114+
{organizations.map(organization => (
133115
<OrganizationLogo key={organization.id} {...organization} />
134116
))}
135117
</nav>

0 commit comments

Comments
 (0)