Skip to content

Commit d347f7b

Browse files
ovflowdcanerakdas
andauthored
feat: conditional exports, numerous bug fixes and ux improvements (#8618)
* feat: conditional exports, numerous bug fixes and ux improvements * fix: remove last dangling \n when present * chore: removed motion from flashable elements, css-only tooltip * chore: drop ui-components publishing changes * chore: code review * chore: code review * chore: tiny ux changes * chore: larger content * Apply suggestions from code review Co-authored-by: Caner Akdas <canerakdas@gmail.com> Signed-off-by: Claudio Wunder <cwunder@gnome.org> * chore: code review * chore: css to tailwind apply * chore: version bump --------- Signed-off-by: Claudio Wunder <cwunder@gnome.org> Co-authored-by: Caner Akdas <canerakdas@gmail.com>
1 parent f11d90f commit d347f7b

File tree

27 files changed

+276
-110
lines changed

27 files changed

+276
-110
lines changed

apps/site/components/Common/Partners/index.module.css

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,3 @@
1414
grid-cols-[repeat(auto-fill,minmax(240px,1fr))]
1515
gap-4;
1616
}
17-
18-
.tooltip {
19-
@apply p-2
20-
text-neutral-900
21-
dark:text-neutral-200;
22-
}

apps/site/components/Common/Partners/index.tsx

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import Tooltip from '@node-core/ui-components/Common/Tooltip';
21
import * as PartnerLogos from '@node-core/ui-components/Icons/PartnerLogos';
32

43
import providePartners from '#site/next-data/providers/partners';
@@ -36,15 +35,15 @@ const renderSmallPartner = (partner: Partner) => {
3635
const Logo = PartnerLogos[partner.id];
3736

3837
return (
39-
<Tooltip
38+
<PartnerButton
39+
aria-label={partner.name}
4040
key={partner.id}
41-
asChild
42-
content={<div className={style.tooltip}>{partner.name}</div>}
41+
size="small"
42+
href={partner.href}
43+
data-tooltip={partner.name}
4344
>
44-
<PartnerButton aria-label={partner.name} size="small" href={partner.href}>
45-
<Logo.Favicon />
46-
</PartnerButton>
47-
</Tooltip>
45+
<Logo.Favicon />
46+
</PartnerButton>
4847
);
4948
};
5049

apps/site/components/withMetaBar.tsx

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,7 @@ const WithMetaBar: FC = () => {
3535
// Since we cannot show the same number of avatars in Mobile / Tablet
3636
// resolution as we do on desktop and there is overflow, we are adjusting
3737
// the number of avatars manually for the resolutions below
38-
const isMobileResolution = useMediaQuery('(max-width: 890px)');
39-
40-
const isTabletResolution = useMediaQuery(
41-
'(min-width: 890px) and (max-width: 1280px)'
42-
);
38+
const isSmallerThanDesktop = useMediaQuery('(max-width: 1280px)');
4339

4440
return (
4541
<MetaBar
@@ -55,7 +51,7 @@ const WithMetaBar: FC = () => {
5551
)]: (
5652
<WithAvatarGroup
5753
usernames={usernames}
58-
limit={isMobileResolution ? 7 : isTabletResolution ? 5 : 9}
54+
limit={isSmallerThanDesktop ? 5 : 8}
5955
/>
6056
),
6157
}),

apps/site/layouts/Post.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ const PostLayout: FC<PropsWithChildren> = ({ children }) => {
2626
<WithNavBar />
2727

2828
<div className={styles.contentLayout}>
29+
<div></div>
30+
2931
<div className={styles.postLayout}>
3032
<main id="main" tabIndex={-1}>
3133
{type === 'vulnerability' && <EOLAlert />}

apps/site/layouts/layouts.module.css

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
@reference "../styles/index.css";
22

33
.baseLayout {
4-
@apply grid
4+
@apply ml:grid
5+
ml:grid-cols-[1fr]
6+
ml:grid-rows-[auto_1fr_auto]
57
h-max
68
min-h-full
7-
w-full
8-
grid-cols-[1fr]
9-
grid-rows-[auto_1fr_auto];
9+
w-full;
1010
}
1111

1212
.centeredLayout {
@@ -104,7 +104,7 @@
104104
justify-center;
105105

106106
main {
107-
@apply max-w-5xl
107+
@apply max-w-7xl
108108
gap-4
109109
px-4
110110
py-12
@@ -135,17 +135,19 @@
135135
}
136136

137137
.contentLayout {
138-
@apply max-w-8xl
138+
@apply max-w-10xl
139139
max-ml:m-0
140-
max-ml:block
140+
3xl:grid-cols-[--spacing(80)_1fr_--spacing(80)]
141+
ml:grid-cols-[0_1fr_--spacing(56)]
142+
ml:grid
141143
mx-auto
142-
grid
144+
block
143145
w-full
144146
grid-rows-[1fr]
145-
sm:grid-cols-[1fr_--spacing(52)]
146-
xl:grid-cols-[1fr_--spacing(80)];
147+
xl:grid-cols-[--spacing(56)_1fr_--spacing(64)]
148+
2xl:grid-cols-[--spacing(72)_1fr_--spacing(72)];
147149

148-
> *:nth-child(1) {
150+
> *:nth-child(2) {
149151
@apply bg-gradient-subtle
150152
dark:bg-gradient-subtle-dark
151153
max-ml:border-l-0
@@ -164,13 +166,12 @@
164166
dark:border-l-neutral-900;
165167

166168
main {
167-
@apply max-w-[660px]
168-
gap-4
169+
@apply gap-4
169170
wrap-anywhere;
170171
}
171172
}
172173

173-
> *:nth-child(2) {
174+
> *:nth-child(3) {
174175
@apply ml:mt-0
175176
ml:max-w-xs
176177
ml:border-l

apps/site/next.fetch.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export const fetchWithRetry = async (
2626
const backoff = Math.max(0, Number(delay) || 0);
2727

2828
const attemptFetch = attempt =>
29-
fetch(url, options).catch(e => {
29+
fetch(url, { ...options, signal: AbortSignal.timeout(30000) }).catch(e => {
3030
if (attempt === retries || !isTimeoutError(e)) {
3131
throw e;
3232
}

packages/rehype-shiki/src/plugin.mjs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,11 @@ export default async function rehypeShikiji(options) {
163163
const meta = parseMeta(preElement.data?.meta);
164164

165165
// Retrieve the whole <pre> contents as a parsed DOM string
166-
const preElementContents = toString(preElement);
166+
const preElementContents = toString(preElement).replace(/\n$/, '');
167+
168+
// Since we removed the trailing newline, we can easily count the
169+
// amount of lines without worrying about an extra empty line at the end of the code block
170+
const lineCount = preElementContents.split('\n').length;
167171

168172
// Grabs the relevant alias/name of the language
169173
const languageId = codeLanguage.slice(languagePrefix.length);
@@ -178,7 +182,8 @@ export default async function rehypeShikiji(options) {
178182
// Adds the original language back to the <pre> element
179183
children[0].properties.class = classNames(
180184
children[0].properties.class,
181-
codeLanguage
185+
codeLanguage,
186+
{ 'no-line-numbers': lineCount < 5, 'no-footer': lineCount === 1 }
182187
);
183188

184189
// Replaces the <pre> element with the updated one

packages/ui-components/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@node-core/ui-components",
3-
"version": "1.5.10",
3+
"version": "1.6.0",
44
"type": "module",
55
"exports": {
66
"./*": {

packages/ui-components/src/Common/BaseButton/index.module.css

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@
99
px-4.5
1010
py-2.5
1111
text-center
12-
font-semibold
13-
motion-safe:transition-colors;
12+
font-semibold;
1413

1514
svg {
1615
@apply size-5;
@@ -124,7 +123,7 @@
124123
after:mx-auto
125124
after:h-px
126125
after:w-2/5
127-
after:bg-gradient-to-r
126+
after:bg-linear-to-r
128127
after:from-green-600/0
129128
after:via-green-600
130129
after:to-green-600/0

packages/ui-components/src/Common/BaseCodeBox/index.module.css

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,19 @@
5353
[counter-increment:line];
5454
}
5555
}
56+
57+
&[class*='plain-text'] {
58+
@apply font-ibm-plex-mono;
59+
}
60+
}
61+
62+
&[class*='no-line-numbers'] > code > [class='line'] {
63+
@apply pl-0;
64+
65+
&:not(:empty:last-child)::after {
66+
@apply content-none
67+
[counter-reset:none];
68+
}
5669
}
5770
}
5871

@@ -62,8 +75,8 @@
6275
justify-between
6376
border-t
6477
border-t-neutral-900
65-
px-4
66-
py-3
78+
px-3
79+
py-2
6780
text-sm
6881
font-medium;
6982

@@ -72,9 +85,14 @@
7285
}
7386

7487
& > .action {
75-
@apply px-3
76-
py-1.5
88+
@apply px-2.5
89+
py-1
90+
text-xs
7791
font-medium;
92+
93+
> svg {
94+
@apply size-4;
95+
}
7896
}
7997
}
8098
}

0 commit comments

Comments
 (0)