Skip to content

Commit dceee1a

Browse files
committed
Merge branch 'release'
2 parents dadb9d1 + 65b605b commit dceee1a

84 files changed

Lines changed: 497 additions & 182 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

apps/typegpu-docs/src/components/ControlPanel.tsx

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import cs from 'classnames';
22
import { useAtom, useAtomValue, useSetAtom } from 'jotai';
3+
import DiscordIconSvg from '../assets/discord-icon.svg';
4+
import GithubIconSvg from '../assets/github-icon.svg';
35
import { useId, useState } from 'react';
46
import { runWithCatchAtom } from '../utils/examples/currentSnackbarAtom.ts';
57
import {
@@ -328,6 +330,18 @@ export function ControlPanel() {
328330
</div>
329331
</>
330332
)}
333+
334+
<div className="mt-auto hidden items-center justify-between pt-2 text-tameplum-800 text-xs md:flex">
335+
<div>&copy; {new Date().getFullYear()} Software Mansion S.A.</div>
336+
<div className="flex items-center gap-3">
337+
<a href="https://discord.gg/8jpfgDqPcM" target="_blank" rel="noreferrer">
338+
<img src={DiscordIconSvg.src} className="opacity-75" alt="discord logo" />
339+
</a>
340+
<a href="https://github.com/software-mansion/TypeGPU" target="_blank" rel="noreferrer">
341+
<img src={GithubIconSvg.src} className="opacity-75" alt="github logo" />
342+
</a>
343+
</div>
344+
</div>
331345
</div>
332346
);
333347
}

apps/typegpu-docs/src/components/ExampleCard.tsx

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ import type { Example } from '../utils/examples/types.ts';
22
import { ExampleLink } from './ExampleLink.tsx';
33

44
export function ExampleCard({ example }: { example: Example }) {
5+
const isDev = example.metadata.dev;
6+
57
return (
68
<ExampleLink exampleKey={example.key} key={example.key}>
79
<div className="flex h-36 items-center justify-center overflow-hidden bg-gray-100">
@@ -20,22 +22,12 @@ export function ExampleCard({ example }: { example: Example }) {
2022
<span className="font-semibold text-gray-400 text-lg">No thumbnail</span>
2123
)}
2224
</div>
23-
<div className="p-3">
24-
<h3 className="mb-2 font-semibold text-black text-lg">{example.metadata.title}</h3>
25-
{((example.metadata.tags && example.metadata.tags.length > 0) || example.metadata.dev) && (
26-
<div className="flex flex-wrap gap-1">
27-
{example.metadata.dev && (
28-
<span className="rounded-full bg-rose-700 px-2 py-1 text-white text-xs">DEV</span>
29-
)}
30-
{(example.metadata.tags ?? []).map((tag: string) => (
31-
<span
32-
key={tag}
33-
className="rounded-full bg-indigo-100 px-2 py-1 text-indigo-800 text-xs"
34-
>
35-
{tag}
36-
</span>
37-
))}
38-
</div>
25+
<div className="flex items-center justify-center gap-2 p-3">
26+
<h3 className="font-semibold text-black text-lg">{example.metadata.title}</h3>
27+
{isDev && (
28+
<span className="shrink-0 rounded-full bg-red-600 px-2 py-0.5 text-[10px] font-bold uppercase tracking-widest text-white">
29+
dev
30+
</span>
3931
)}
4032
</div>
4133
</ExampleLink>

apps/typegpu-docs/src/components/ExampleLayout.tsx

Lines changed: 31 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,11 @@ import { useSetAtom } from 'jotai';
22
import type { ReactNode } from 'react';
33
import { useId, useRef } from 'react';
44
import CrossSvg from '../assets/cross.svg';
5-
import DiscordIconSvg from '../assets/discord-icon.svg';
6-
import GithubIconSvg from '../assets/github-icon.svg';
75
import HamburgerSvg from '../assets/hamburger.svg';
86
import {
97
codeEditorShownAtom,
108
experimentalExamplesShownAtom,
9+
groupExamplesByCategoryAtom,
1110
menuShownAtom,
1211
} from '../utils/examples/exampleViewStateAtoms.ts';
1312
import { SearchableExampleList } from './SearchableExampleList.tsx';
@@ -52,14 +51,16 @@ function SideMenu() {
5251
experimentalExamplesShownAtom,
5352
true,
5453
);
54+
const [groupByCategory, setGroupByCategory] = useHydratedAtom(groupExamplesByCategoryAtom, false);
5555
const scrollRef = useRef<HTMLDivElement>(null);
5656
const experimentalExamplesToggleId = useId();
57+
const groupByCategoryToggleId = useId();
5758

5859
return (
5960
<aside className="absolute inset-0 z-50 box-border flex w-full flex-col bg-white md:static md:w-75 md:rounded-2xl">
60-
<header className="p-5">
61+
<header className="px-5 py-3">
6162
<div className="grid place-items-center">
62-
<a href="/TypeGPU" className="box-border grid h-20 cursor-pointer place-content-center">
63+
<a href="/TypeGPU" className="box-border grid h-12 cursor-pointer place-content-center">
6364
<img className="w-40" src="/TypeGPU/typegpu-logo-light.svg" alt="TypeGPU Logo" />
6465
</a>
6566
</div>
@@ -74,22 +75,9 @@ function SideMenu() {
7475
<hr className="my-0 box-border w-full border-tameplum-100 border-t" />
7576
</div>
7677

77-
<div className="my-5 min-h-0 flex-1 overflow-y-auto px-5" ref={scrollRef}>
78-
<section className="mb-5 space-y-2 border-tameplum-100 border-b pb-5">
79-
<h1 className="font-medium text-lg">Welcome to examples page</h1>
80-
<p className="text-sm">
81-
Test out the power of our TypeScript library and get to know TypeGPU.
82-
</p>
83-
<a
84-
href="/TypeGPU/why-typegpu"
85-
className="bg-gradient-to-r from-gradient-purple-dark to-gradient-blue-dark bg-clip-text text-sm text-transparent underline"
86-
>
87-
Learn more about TypeGPU here
88-
</a>
89-
</section>
90-
78+
<div className="my-3 min-h-0 flex-1 overflow-y-auto px-5" ref={scrollRef}>
9179
<SearchableExampleList
92-
excludeTags={experimentalShowing ? [] : ['experimental']}
80+
excludeApis={experimentalShowing ? [] : ['~unstable']}
9381
scrollContainerRef={scrollRef}
9482
/>
9583
</div>
@@ -98,28 +86,30 @@ function SideMenu() {
9886
<hr className="my-0 box-border w-full border-tameplum-100 border-t" />
9987
</div>
10088

101-
<label
102-
htmlFor={experimentalExamplesToggleId}
103-
className="flex cursor-pointer items-center justify-between gap-3 p-5 text-sm"
104-
>
105-
<span>Experimental examples</span>
106-
<Toggle
107-
id={experimentalExamplesToggleId}
108-
checked={experimentalShowing}
109-
onChange={(e) => setExperimentalShowing(e.target.checked)}
110-
/>
111-
</label>
112-
113-
<div className="flex justify-between px-5 pb-5 text-tameplum-800 text-xs">
114-
<div>&copy; {new Date().getFullYear()} Software Mansion S.A.</div>
115-
<div className="flex items-center gap-3">
116-
<a href="https://discord.gg/8jpfgDqPcM" target="_blank" rel="noreferrer">
117-
<img src={DiscordIconSvg.src} className="opacity-75" alt="github logo" />
118-
</a>
119-
<a href="https://github.com/software-mansion/TypeGPU" target="_blank" rel="noreferrer">
120-
<img src={GithubIconSvg.src} className="opacity-75" alt="discord logo" />
121-
</a>
122-
</div>
89+
<div className="flex items-center gap-2 px-5 py-3 text-xs text-gray-600">
90+
<label
91+
htmlFor={experimentalExamplesToggleId}
92+
className="flex flex-1 cursor-pointer items-center justify-between gap-2"
93+
>
94+
<span className="whitespace-nowrap">Experimental</span>
95+
<Toggle
96+
id={experimentalExamplesToggleId}
97+
checked={experimentalShowing}
98+
onChange={(e) => setExperimentalShowing(e.target.checked)}
99+
/>
100+
</label>
101+
<div className="h-4 w-px shrink-0 bg-tameplum-100" />
102+
<label
103+
htmlFor={groupByCategoryToggleId}
104+
className="flex flex-1 cursor-pointer items-center justify-between gap-2"
105+
>
106+
<span className="whitespace-nowrap">Grouped</span>
107+
<Toggle
108+
id={groupByCategoryToggleId}
109+
checked={groupByCategory}
110+
onChange={(e) => setGroupByCategory(e.target.checked)}
111+
/>
112+
</label>
123113
</div>
124114
</aside>
125115
);

apps/typegpu-docs/src/components/ExampleView.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -118,20 +118,20 @@ export function ExampleView({ example, common }: Props) {
118118
)}
119119

120120
{codeEditorShown && (
121-
<div className="absolute z-20 h-[calc(100%-2rem)] w-[calc(100%-2rem)] bg-tameplum-50 md:relative md:h-full md:w-full">
121+
<div className="absolute z-20 h-[calc(100%-2rem)] w-[calc(100%-2rem)] overflow-hidden rounded-tl-xl bg-tameplum-50 md:relative md:h-full md:w-full">
122122
<div className="absolute inset-0 flex flex-col justify-between">
123123
<div className="h-12 pt-16 md:pt-0">
124-
<div className="flex h-full overflow-x-auto border-gray-300">
124+
<div className="flex h-full gap-1 overflow-x-auto border-b border-tameplum-100 px-1">
125125
{editorTabsList.map((fileName) => (
126126
<button
127127
key={fileName}
128128
type="button"
129129
onClick={() => setCurrentFilePath(fileName)}
130130
className={cs(
131-
'text-nowrap rounded-t-lg rounded-b-none px-4 text-sm',
131+
'shrink-0 -mb-px h-full rounded-t-lg border-b-2 px-4 text-sm font-medium transition-colors',
132132
currentFilePath === fileName
133-
? 'bg-gradient-to-br from-gradient-purple to-gradient-blue text-white hover:from-gradient-purple-dark hover:to-gradient-blue-dark'
134-
: 'border-2 border-tameplum-100 bg-white hover:bg-tameplum-20',
133+
? 'border-purple-500 bg-white text-purple-700 shadow-sm'
134+
: 'border-transparent bg-tameplum-100 text-tameplum-600 hover:border-tameplum-300 hover:bg-tameplum-200 hover:text-tameplum-900',
135135
)}
136136
>
137137
{fileName}

0 commit comments

Comments
 (0)