Skip to content

Commit 668fdce

Browse files
committed
feat: implement CSS variables
1 parent ec48bb4 commit 668fdce

84 files changed

Lines changed: 1580 additions & 768 deletions

Some content is hidden

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

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ node_modules/
55

66
# next.js
77
.next/
8+
.velite/
89

910
# Expo
1011
.expo/

.storybook/main.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { reactUniversal } from '@react-universal/vite-plugin';
12
import type { StorybookConfig } from '@storybook/react-vite';
23
import { mergeConfig } from 'vite';
34

@@ -15,6 +16,7 @@ const config: StorybookConfig = {
1516
// eslint-disable-next-line @typescript-eslint/no-shadow
1617
viteFinal: (config) =>
1718
mergeConfig(config, {
19+
plugins: [reactUniversal()],
1820
resolve: {
1921
conditions: ['source'],
2022
},

.storybook/preview.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { ThemeProvider } from '@react-universal/core';
1+
import { UniversalProvider } from '@react-universal/core';
22
import { INITIAL_VIEWPORTS } from '@storybook/addon-viewport';
33
import type { Preview } from '@storybook/react';
44

@@ -10,9 +10,9 @@ const preview: Preview = {
1010
},
1111
decorators: [
1212
(Story, context) => (
13-
<ThemeProvider>
13+
<UniversalProvider>
1414
<Story {...context} />
15-
</ThemeProvider>
15+
</UniversalProvider>
1616
),
1717
],
1818
};

app/App.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import {
66
Text,
77
View,
88
} from '@react-universal/components';
9-
import { ThemeProvider, isWeb, styled } from '@react-universal/core';
9+
import { UniversalProvider, isWeb, styled } from '@react-universal/core';
1010
import { Defs, G, Path, Svg, TSpan, Text as TextSvg, Use } from '@react-universal/svg';
1111
import * as ScreenOrientation from 'expo-screen-orientation';
1212
import { StatusBar } from 'expo-status-bar';
@@ -60,7 +60,7 @@ export default function App() {
6060
return (
6161
<SafeAreaProvider>
6262
<StatusBar style="auto" />
63-
<ThemeProvider>
63+
<UniversalProvider>
6464
<ScrollView>
6565
<Svg
6666
sx={{
@@ -297,7 +297,7 @@ export default function App() {
297297
))}
298298
</Grid>
299299
</ScrollView>
300-
</ThemeProvider>
300+
</UniversalProvider>
301301
</SafeAreaProvider>
302302
);
303303
}

app/package.json

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,18 @@
1111
"web": "expo start --web"
1212
},
1313
"dependencies": {
14-
"@react-native/normalize-colors": "0.76.3",
14+
"@react-native/normalize-colors": "0.76.5",
1515
"@react-universal/components": "workspace:*",
1616
"@react-universal/core": "workspace:*",
1717
"@react-universal/svg": "workspace:*",
18-
"expo": "^52.0.17",
19-
"expo-dev-client": "~5.0.5",
20-
"expo-screen-orientation": "~8.0.1",
21-
"expo-splash-screen": "~0.29.16",
18+
"@types/react": "~18.3.18",
19+
"expo": "^52.0.21",
20+
"expo-dev-client": "~5.0.6",
21+
"expo-screen-orientation": "~8.0.2",
22+
"expo-splash-screen": "~0.29.18",
2223
"expo-status-bar": "~2.0.0",
2324
"react": "18.3.1",
24-
"react-native": "0.76.3",
25+
"react-native": "0.76.5",
2526
"react-native-safe-area-context": "4.12.0",
2627
"react-native-svg": "15.8.0",
2728
"react-native-unistyles": "^2.20.0"

docs/.velite/docs.json

Lines changed: 0 additions & 48 deletions
This file was deleted.

docs/.velite/index.d.ts

Lines changed: 0 additions & 8 deletions
This file was deleted.

docs/.velite/index.js

Lines changed: 0 additions & 3 deletions
This file was deleted.

docs/app/docs/layout.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
import { Container } from '@react-universal/components';
2+
import { Header } from '#/components/Header';
3+
import { SidebarStart } from './sidebar';
24

35
interface LayoutProps {
46
children: React.ReactNode;
@@ -7,10 +9,10 @@ interface LayoutProps {
79
export default function Layout({ children }: LayoutProps) {
810
return (
911
<>
10-
{/* <Header /> */}
12+
<Header />
1113
<main>
1214
<Container maxWidth="xl" sx={{ flexDir: 'row' }}>
13-
{/* <SidebarStart /> */}
15+
<SidebarStart />
1416
{/* <SkipNavContent /> */}
1517
{children}
1618
</Container>

docs/app/docs/sidebar.tsx

Lines changed: 48 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,54 @@
1-
import type { BoxProps } from '@react-universal/components';
1+
'use client';
2+
3+
import type { ViewProps, ViewType } from '@react-universal/components';
24
import { Stack } from '@react-universal/components';
35
import { Aside } from '@react-universal/elements';
6+
import { useRef } from 'react';
7+
import { SideNav } from '#/components/SideNav';
8+
import { useRoute } from '#/lib/useRoute';
9+
import { useScrollIntoView } from '#/lib/useScrollIntoView';
10+
11+
export const SidebarStart: React.FC<ViewProps> = (props) => {
12+
const containerRef = useRef<React.ElementRef<ViewType>>(null);
13+
const route = useRoute();
14+
15+
useScrollIntoView(containerRef, '[aria-current="page"]', 'center');
16+
17+
return (
18+
<Aside
19+
ref={containerRef}
20+
sx={{
21+
display: { xs: 'none', md: 'block' },
22+
flexShrink: 0,
23+
fontSize: '0.875rem',
24+
height: 'var(--content-height)',
25+
ms: -3,
26+
overflowY: 'auto',
27+
overscrollBehavior: 'contain',
28+
pe: 5,
29+
position: 'sticky' as any,
30+
py: 8,
31+
top: 'var(--header-height)',
32+
width: '16rem',
33+
}}
34+
{...props}
35+
>
36+
<Stack spacing={6}>
37+
{route.getSidebarNavItems().map((group) => (
38+
<SideNav
39+
key={group.title}
40+
currentUrl={route.currentUrl}
41+
title={group.title}
42+
items={group.items}
43+
status={group.status}
44+
/>
45+
))}
46+
</Stack>
47+
</Aside>
48+
);
49+
};
450

5-
export const SidebarEnd: React.FC<BoxProps> = ({ children, sx, ...props }) => (
51+
export const SidebarEnd: React.FC<ViewProps> = ({ children, sx, ...props }) => (
652
<Aside
753
as="aside"
854
sx={{

0 commit comments

Comments
 (0)