Skip to content

Commit

Permalink
docs: fix Benchmark graph width
Browse files Browse the repository at this point in the history
  • Loading branch information
chenjiahan committed Aug 29, 2024
1 parent 713e02a commit bec3a7d
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 4 deletions.
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

0 comments on commit bec3a7d

Please sign in to comment.