Skip to content

Commit 24badc6

Browse files
Site redirects and bugs (#793)
1 parent 0edf7c8 commit 24badc6

File tree

7 files changed

+44
-11
lines changed

7 files changed

+44
-11
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ document.write(`
7474

7575
---
7676

77-
Want to work at a higher level while maximising style re-use? Check out 🍨 [Sprinkles](https://vanilla-extract.style/documentation/sprinkles-api), our official zero-runtime atomic CSS framework, built on top of vanilla-extract.
77+
Want to work at a higher level while maximising style re-use? Check out 🍨 [Sprinkles](https://vanilla-extract.style/documentation/packages/sprinkles), our official zero-runtime atomic CSS framework, built on top of vanilla-extract.
7878

7979
---
8080

@@ -1044,7 +1044,7 @@ document.write(`
10441044

10451045
Your recipe configuration can also make use of existing variables, classes and styles.
10461046

1047-
For example, you can pass in the result of your [`sprinkles`](https://vanilla-extract.style/documentation/sprinkles-api) function directly.
1047+
For example, you can pass in the result of your [`sprinkles`](https://vanilla-extract.style/documentation/packages/sprinkles) function directly.
10481048

10491049
```ts
10501050
import { recipe } from '@vanilla-extract/recipes';

site/legacy-routes.json

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
[
2+
{ "from": "/documentation/styling-api", "to": "/documentation/styling/" },
3+
{
4+
"from": "/documentation/sprinkles-api/",
5+
"to": "/documentation/packages/sprinkles/"
6+
},
7+
{
8+
"from": "/documentation/recipes-api/",
9+
"to": "/documentation/packages/recipes/"
10+
},
11+
{
12+
"from": "/documentation/dynamic-api/",
13+
"to": "/documentation/packages/dynamic/"
14+
},
15+
{
16+
"from": "/documentation/utility-functions/",
17+
"to": "/documentation/packages/css-utils/"
18+
},
19+
{
20+
"from": "/documentation/setup/",
21+
"to": "/documentation/getting-started/#bundler-integration"
22+
}
23+
]

site/src/App.tsx

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
import { Route } from 'react-router-dom';
1+
import { Redirect, Route, Switch } from 'react-router-dom';
22
import { Title, Meta } from 'react-head';
33
import { HomePage } from './HomePage/HomePage';
44
import { DocsPage } from './DocsPage/DocsPage';
55
import { ColorModeProvider } from './ColorModeToggle/ColorModeToggle';
6+
import legacyRoutes from '../legacy-routes.json';
67
import './App.css';
78

89
const pageTitle = 'vanilla-extract — Zero-runtime Stylesheets-in-TypeScript.';
@@ -18,7 +19,14 @@ export default () => {
1819
<Meta property="og:description" content={description} />
1920
<Meta name="twitter:description" content={description} />
2021
<Route path="/" exact component={HomePage} />
21-
<Route path="/documentation" component={DocsPage} />
22+
23+
<Switch>
24+
{legacyRoutes.map((route) => (
25+
<Redirect key={route.from} from={route.from} to={route.to} />
26+
))}
27+
28+
<Route path="/documentation" component={DocsPage} />
29+
</Switch>
2230
</ColorModeProvider>
2331
);
2432
};

site/src/Code/CompiledCode.css.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ const belowSideBySideStyles = (styles: StyleRule): StyleRule => ({
104104
export const showCssOnMobile = style({});
105105

106106
export const maxHeight = style({
107-
maxHeight: 800,
107+
maxHeight: 'min(65vh, 800px)',
108108
overflow: 'auto',
109109
});
110110

site/src/Code/CompiledCode.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ export interface CompiledCodeProps {
2626
export const CompiledCode = ({ code, css, background }: CompiledCodeProps) => {
2727
const [activeFileName, setActiveFileName] = useState(code[0].fileName);
2828
const [showCss, setShowCss] = useState(false);
29+
const showOutputPanel = css && activeFileName?.endsWith('.css.ts');
2930

3031
const activeFile = code.filter(
3132
({ fileName }) => fileName === activeFileName,
@@ -126,7 +127,7 @@ export const CompiledCode = ({ code, css, background }: CompiledCodeProps) => {
126127
})}
127128
</Box>
128129
) : null}
129-
<Box padding="large" margin="-large">
130+
<Box padding="large" margin="-large" overflow="hidden">
130131
<Box
131132
display="flex"
132133
className={showCss ? styles.showCssOnMobile : undefined}
@@ -146,7 +147,7 @@ export const CompiledCode = ({ code, css, background }: CompiledCodeProps) => {
146147
{activeFile.contents}
147148
</SyntaxHighlighter>
148149
</Box>
149-
{css && activeFileName?.endsWith('.css.ts') ? (
150+
{showOutputPanel ? (
150151
<Box
151152
id="outputContainer"
152153
width="full"
@@ -179,7 +180,7 @@ export const CompiledCode = ({ code, css, background }: CompiledCodeProps) => {
179180
</Box>
180181
</Stack>
181182

182-
{css ? (
183+
{showOutputPanel ? (
183184
<Box
184185
display="flex"
185186
justifyContent="flex-end"

site/src/HomePage/HomePage.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ export const HomePage = () => {
266266
<Feature title="Built for extension">
267267
Use libraries like{' '}
268268
<Link
269-
to="/documentation/sprinkles-api"
269+
to="/documentation/packages/sprinkles"
270270
size="small"
271271
underline="always"
272272
inline
@@ -275,7 +275,7 @@ export const HomePage = () => {
275275
</Link>
276276
,{' '}
277277
<Link
278-
to="/documentation/recipes-api"
278+
to="/documentation/packages/recipes"
279279
size="small"
280280
underline="always"
281281
inline

site/webpack.config.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,13 @@ const { VanillaExtractPlugin } = require('@vanilla-extract/webpack-plugin');
66
const nodeExternals = require('webpack-node-externals');
77
const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer');
88
const { pages } = require('./docs-manifest.json');
9+
const legacyRoutes = require('./legacy-routes.json');
910
const targetDirectory = join(__dirname, 'dist');
1011

1112
const isProduction = process.env.NODE_ENV === 'production';
1213

1314
const htmlRenderPlugin = new HtmlRenderPlugin({
14-
routes: ['', ...pages],
15+
routes: ['', ...pages, ...legacyRoutes.map(({ from }) => from)],
1516
renderConcurrency: 'parallel',
1617
renderDirectory: targetDirectory,
1718
mapStatsToParams: ({ webpackStats }) => {

0 commit comments

Comments
 (0)