Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: fix Benchmark graph width #3317

Merged
merged 1 commit into from
Aug 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion website/docs/en/guide/start/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Rsbuild's build performance is on par with native Rspack. This is the time it ta

import { BenchmarkGraph } from '@components/Benchmark';

<BenchmarkGraph />
<BenchmarkGraph short />

> The above data comes from the [performance-compare](https://github.com/rspack-contrib/performance-compare) benchmark.

Expand Down
2 changes: 1 addition & 1 deletion website/docs/zh/guide/start/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Rsbuild 的构建性能与原生 Rspack 处于同一水平,以下是构建 100

import { BenchmarkGraph } from '@components/Benchmark';

<BenchmarkGraph />
<BenchmarkGraph short />

> 以上数据来自 [performance-compare](https://github.com/rspack-contrib/performance-compare) benchmark。

Expand Down
7 changes: 7 additions & 0 deletions website/theme/components/Benchmark.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,13 @@
margin-top: 4rem;
}

.short {
// Temp code to fix the width of the graph
:global(.container_72b36) {
width: 40vw;
}
}

@media (min-width: 640px) {
.title {
font-size: 3rem;
Expand Down
10 changes: 8 additions & 2 deletions website/theme/components/Benchmark.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,14 @@ const BENCHMARK_DATA: BenchmarkData = {
},
};

export function BenchmarkGraph() {
return <BaseBenchmark data={BENCHMARK_DATA} />;
export function BenchmarkGraph(props: { short?: boolean }) {
return props.short ? (
<div className={styles.short}>
<BaseBenchmark data={BENCHMARK_DATA} />
</div>
) : (
<BaseBenchmark data={BENCHMARK_DATA} />
);
}

export function Benchmark() {
Expand Down
Loading