Skip to content

Commit

Permalink
Remove chakra ui from docs (#32)
Browse files Browse the repository at this point in the history
  • Loading branch information
ntorionbearstudio authored Aug 28, 2024
1 parent 5613c3c commit 134daa4
Show file tree
Hide file tree
Showing 36 changed files with 353 additions and 1,952 deletions.
27 changes: 17 additions & 10 deletions docs/components/demos/theme.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,17 @@ import {
VStack,
Text,
} from 'react-native-ficus-ui';
import { useTheme } from 'nextra-theme-docs';
import { useEffect, useState } from 'react';

export const Theme = () => {
const { theme: nextraTheme } = useTheme();
const [textColor, setTextColor] = useState(nextraTheme === 'dark' ? 'white' : 'black');

useEffect(() => {
setTextColor(nextraTheme === 'dark' ? 'white' : 'black')
}, [nextraTheme])

const ThemePalette = ({ color }) => (
<HStack spacing={5}>
{[50, 100, 200, 300, 400, 500, 600, 700, 800].map((i) => (
Expand Down Expand Up @@ -76,16 +85,14 @@ export const Theme = () => {
</VStack>

<Box mt="xl">
<Text fontSize="xs">Example of text with font size xs</Text>
<Text fontSize="sm">Example of text with font size sm</Text>
<Text fontSize="md">Example of text with font size md</Text>
<Text fontSize="lg">Example of text with font size lg</Text>
<Text fontSize="xl">Example of text with font size xl</Text>
<Text fontSize="2xl">Example of text with font size 2xl</Text>
<Text fontSize="3xl">Example of text with font size 3xl</Text>
<Text fontSize="4xl">Example of text with font size 4xl</Text>
<Text fontSize="5xl">Example of text with font size 5xl</Text>
<Text fontSize="6xl">Example of text with font size 6xl</Text>
<Text fontSize="xs" color={textColor}>Example of text with font size xs</Text>
<Text fontSize="sm" color={textColor}>Example of text with font size sm</Text>
<Text fontSize="md" color={textColor}>Example of text with font size md</Text>
<Text fontSize="lg" color={textColor}>Example of text with font size lg</Text>
<Text fontSize="xl" color={textColor}>Example of text with font size xl</Text>
<Text fontSize="2xl" color={textColor}>Example of text with font size 2xl</Text>
<Text fontSize="3xl" color={textColor}>Example of text with font size 3xl</Text>
<Text fontSize="4xl" color={textColor}>Example of text with font size 4xl</Text>
</Box>
</Box>
</ThemeProvider>
Expand Down
201 changes: 0 additions & 201 deletions docs/components/homepage.jsx

This file was deleted.

94 changes: 54 additions & 40 deletions docs/components/iframe.jsx
Original file line number Diff line number Diff line change
@@ -1,65 +1,79 @@
import React, { useState, useRef, useEffect } from 'react';
import {
Box,
Slider,
SliderTrack,
SliderFilledTrack,
SliderThumb,
useMediaQuery,
} from '@chakra-ui/react';
import { DragHandleIcon } from '@chakra-ui/icons';
import { useTheme } from 'nextra-theme-docs';

export const ResizableIframe = () => {
const [dimensions, setDimensions] = useState({ width: 800 });
const iframeRef = useRef(null);

const [sliderValue, setSliderValue] = useState(60);

const [isMediumScreen] = useMediaQuery('(min-width: 600px)');

const { theme } = useTheme();

const [borderColor, setBorderColor] = useState('#edf2f7');

useEffect(() => {
setBorderColor(theme === 'dark' ? '#4A5568' : '#edf2f7');
}, [theme]);
// Media query state to detect screen size
const [isMediumScreen, setIsMediumScreen] = useState(false);

// Update dimensions based on slider value
useEffect(() => {
setDimensions({ width: sliderValue <= 40 ? 40 : sliderValue });
}, [sliderValue]);

// Update screen size state on window resize
useEffect(() => {
const handleResize = () => setIsMediumScreen(window.innerWidth >= 600);
handleResize();
window.addEventListener('resize', handleResize);
return () => window.removeEventListener('resize', handleResize);
}, []);

return (
<Box>
<div className="my-4">
<iframe
ref={iframeRef}
src="/demo"
style={{
width: `${isMediumScreen ? dimensions.width : '100'}%`,
height: '600px',
borderWidth: 1,
borderRadius: 10,
borderColor,
borderWidth: '1px',
borderRadius: '10px',
}}
/>
className="border border-gray-100 dark:border-gray-700"
></iframe>

{/* Slider only visible on medium screens */}
{isMediumScreen && (
<Slider
aria-label="slider-ex-1"
value={sliderValue}
onChange={(val) => setSliderValue(val)}
min={0}
max={100}
colorScheme={sliderValue < 40 ? 'gray' : 'teal'}
>
<SliderTrack>
<SliderFilledTrack />
</SliderTrack>
<SliderThumb boxSize={6}>
<Box color="teal" as={DragHandleIcon} />
</SliderThumb>
</Slider>
<div className="flex flex-1 items-center mt-4">
<input
type="range"
aria-label="Resize slider"
value={sliderValue}
onChange={(e) => setSliderValue(parseInt(e.target.value))}
min={0}
max={100}
className={`w-full flex-1 h-2 bg-gray-200 rounded-lg appearance-none cursor-pointer ${
sliderValue < 40 ? 'accent-gray-400' : 'accent-teal-500'
}`}
style={{
flex: 1,
accentColor: 'teal'
}}
/>
<div
className="w-6 h-6 flex justify-center items-center bg-teal-500 rounded-full ml-2"
style={{ color: 'white' }}
>
{/* This icon simulates the DragHandleIcon */}
<svg
xmlns="http://www.w3.org/2000/svg"
className="h-4 w-4"
viewBox="0 0 20 20"
fill="currentColor"
>
<path
fillRule="evenodd"
d="M5 6a1 1 0 110-2h10a1 1 0 110 2H5zm0 6a1 1 0 110-2h10a1 1 0 110 2H5zm0 6a1 1 0 110-2h10a1 1 0 110 2H5z"
clipRule="evenodd"
/>
</svg>
</div>
</div>
)}
</Box>
</div>
);
};
5 changes: 0 additions & 5 deletions docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,8 @@
"lint": "next lint"
},
"dependencies": {
"@chakra-ui/icons": "^2.1.1",
"@chakra-ui/react": "^2.8.2",
"@emotion/react": "^11.13.0",
"@emotion/styled": "^11.13.0",
"eslint-config-next": "^14.2.6",
"focus-visible": "^5.1.0",
"framer-motion": "^11.3.28",
"intersection-observer": "^0.10.0",
"isomorphic-git": "1.21.0",
"markdown-to-jsx": "^6.11.4",
Expand Down
Loading

0 comments on commit 134daa4

Please sign in to comment.