Skip to content

Commit

Permalink
feat: implement CSS variables
Browse files Browse the repository at this point in the history
  • Loading branch information
efoken committed Dec 23, 2024
1 parent ec48bb4 commit 668fdce
Show file tree
Hide file tree
Showing 84 changed files with 1,580 additions and 768 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ node_modules/

# next.js
.next/
.velite/

# Expo
.expo/
Expand Down
2 changes: 2 additions & 0 deletions .storybook/main.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { reactUniversal } from '@react-universal/vite-plugin';
import type { StorybookConfig } from '@storybook/react-vite';
import { mergeConfig } from 'vite';

Expand All @@ -15,6 +16,7 @@ const config: StorybookConfig = {
// eslint-disable-next-line @typescript-eslint/no-shadow
viteFinal: (config) =>
mergeConfig(config, {
plugins: [reactUniversal()],
resolve: {
conditions: ['source'],
},
Expand Down
6 changes: 3 additions & 3 deletions .storybook/preview.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ThemeProvider } from '@react-universal/core';
import { UniversalProvider } from '@react-universal/core';
import { INITIAL_VIEWPORTS } from '@storybook/addon-viewport';
import type { Preview } from '@storybook/react';

Expand All @@ -10,9 +10,9 @@ const preview: Preview = {
},
decorators: [
(Story, context) => (
<ThemeProvider>
<UniversalProvider>
<Story {...context} />
</ThemeProvider>
</UniversalProvider>
),
],
};
Expand Down
6 changes: 3 additions & 3 deletions app/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
Text,
View,
} from '@react-universal/components';
import { ThemeProvider, isWeb, styled } from '@react-universal/core';
import { UniversalProvider, isWeb, styled } from '@react-universal/core';
import { Defs, G, Path, Svg, TSpan, Text as TextSvg, Use } from '@react-universal/svg';
import * as ScreenOrientation from 'expo-screen-orientation';
import { StatusBar } from 'expo-status-bar';
Expand Down Expand Up @@ -60,7 +60,7 @@ export default function App() {
return (
<SafeAreaProvider>
<StatusBar style="auto" />
<ThemeProvider>
<UniversalProvider>
<ScrollView>
<Svg
sx={{
Expand Down Expand Up @@ -297,7 +297,7 @@ export default function App() {
))}
</Grid>
</ScrollView>
</ThemeProvider>
</UniversalProvider>
</SafeAreaProvider>
);
}
13 changes: 7 additions & 6 deletions app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,18 @@
"web": "expo start --web"
},
"dependencies": {
"@react-native/normalize-colors": "0.76.3",
"@react-native/normalize-colors": "0.76.5",
"@react-universal/components": "workspace:*",
"@react-universal/core": "workspace:*",
"@react-universal/svg": "workspace:*",
"expo": "^52.0.17",
"expo-dev-client": "~5.0.5",
"expo-screen-orientation": "~8.0.1",
"expo-splash-screen": "~0.29.16",
"@types/react": "~18.3.18",
"expo": "^52.0.21",
"expo-dev-client": "~5.0.6",
"expo-screen-orientation": "~8.0.2",
"expo-splash-screen": "~0.29.18",
"expo-status-bar": "~2.0.0",
"react": "18.3.1",
"react-native": "0.76.3",
"react-native": "0.76.5",
"react-native-safe-area-context": "4.12.0",
"react-native-svg": "15.8.0",
"react-native-unistyles": "^2.20.0"
Expand Down
48 changes: 0 additions & 48 deletions docs/.velite/docs.json

This file was deleted.

8 changes: 0 additions & 8 deletions docs/.velite/index.d.ts

This file was deleted.

3 changes: 0 additions & 3 deletions docs/.velite/index.js

This file was deleted.

6 changes: 4 additions & 2 deletions docs/app/docs/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import { Container } from '@react-universal/components';
import { Header } from '#/components/Header';
import { SidebarStart } from './sidebar';

interface LayoutProps {
children: React.ReactNode;
Expand All @@ -7,10 +9,10 @@ interface LayoutProps {
export default function Layout({ children }: LayoutProps) {
return (
<>
{/* <Header /> */}
<Header />
<main>
<Container maxWidth="xl" sx={{ flexDir: 'row' }}>
{/* <SidebarStart /> */}
<SidebarStart />
{/* <SkipNavContent /> */}
{children}
</Container>
Expand Down
50 changes: 48 additions & 2 deletions docs/app/docs/sidebar.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,54 @@
import type { BoxProps } from '@react-universal/components';
'use client';

import type { ViewProps, ViewType } from '@react-universal/components';
import { Stack } from '@react-universal/components';
import { Aside } from '@react-universal/elements';
import { useRef } from 'react';
import { SideNav } from '#/components/SideNav';
import { useRoute } from '#/lib/useRoute';
import { useScrollIntoView } from '#/lib/useScrollIntoView';

export const SidebarStart: React.FC<ViewProps> = (props) => {
const containerRef = useRef<React.ElementRef<ViewType>>(null);
const route = useRoute();

useScrollIntoView(containerRef, '[aria-current="page"]', 'center');

return (
<Aside
ref={containerRef}
sx={{
display: { xs: 'none', md: 'block' },
flexShrink: 0,
fontSize: '0.875rem',
height: 'var(--content-height)',
ms: -3,
overflowY: 'auto',
overscrollBehavior: 'contain',
pe: 5,
position: 'sticky' as any,
py: 8,
top: 'var(--header-height)',
width: '16rem',
}}
{...props}
>
<Stack spacing={6}>
{route.getSidebarNavItems().map((group) => (
<SideNav
key={group.title}
currentUrl={route.currentUrl}
title={group.title}
items={group.items}
status={group.status}
/>
))}
</Stack>
</Aside>
);
};

export const SidebarEnd: React.FC<BoxProps> = ({ children, sx, ...props }) => (
export const SidebarEnd: React.FC<ViewProps> = ({ children, sx, ...props }) => (
<Aside
as="aside"
sx={{
Expand Down
Loading

0 comments on commit 668fdce

Please sign in to comment.