Skip to content

Commit

Permalink
Merge pull request #23 from alnavarrop99/style/responsive
Browse files Browse the repository at this point in the history
Feat: create responsive design
  • Loading branch information
alnavarrop99 authored Apr 21, 2024
2 parents 56f326b + 4079db9 commit 847b61e
Show file tree
Hide file tree
Showing 37 changed files with 2,316 additions and 1,599 deletions.
7 changes: 4 additions & 3 deletions src/components/ui/scroll-area.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
import type { Meta, StoryObj } from '@storybook/react'
import { ScrollArea } from '@/components/ui/scroll-area'
import { ScrollArea, ScrollBar } from '@/components/ui/scroll-area'
import { Separator } from '@/components/ui/separator'

const tags = Array.from({ length: 50 }).map(
(_, i, a) => `v1.2.0-beta.${a.length - i}`
(_, i, a) => `v1.2.0-beta.${a.length - i} Lorem ipsum dolor sit amet, qui minim labore adipisicing minim sint cillum sint consectetur cupidatat.`
)
function Basic( { ...props }: React.ComponentProps< typeof ScrollArea > ) {
return (
<ScrollArea {...props} className="h-72 w-48 rounded-md border">
<ScrollBar orientation='horizontal' />
<div className="p-4">
<h4 className="mb-4 text-sm font-medium leading-none">Tags</h4>
{tags.map((tag) => (
<>
<div key={tag} className="text-sm">
<div key={tag} className="text-sm w-80">
{tag}
</div>
<Separator className="my-2" />
Expand Down
Empty file removed src/lib/hook/.gitkeep
Empty file.
32 changes: 32 additions & 0 deletions src/lib/hook/useScreens.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import { useEffect, useState } from 'react'
import { screens } from 'tailwindcss/defaultTheme'

/* eslint-disable-next-line */
type TScreen = 'sm' | 'md' | 'lg'

/* eslint-disable-next-line */
type TUseScreens = () => TScreen

/* eslint-disable-next-line */
export const useScreen: TUseScreens = () => {
const [theme, setTheme] = useState<TScreen>('sm')
useEffect(() => {
const onChange = () => {
if (window.innerWidth >= +screens.md?.replace(/px/g, '')) {
setTheme('md')
}

if (window.innerWidth >= +screens.lg?.replace(/px/g, '')) {
setTheme('lg')
}
}
window.addEventListener('resize', onChange)
onChange()

return () => {
window.removeEventListener('resize', onChange)
}
}, [])

return theme
}
2 changes: 1 addition & 1 deletion src/lib/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export const translate = () => {
'/report': { name: 'Reportes', validation: true, icon: icons.BookA },
'/notification': {
name: 'Notificaciones',
validation: false,
validation: true,
icon: icons.Notebook,
},
'/update': { name: 'Editar', validation: false, icon: icons.Upload },
Expand Down
6 changes: 3 additions & 3 deletions src/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import {
import { routeTree } from './routeTree.gen'

async function enableMocking() {
if (!+import.meta.env.VITE_MSW || !import.meta.env.DEV) {
return
}
// if (!+import.meta.env.VITE_MSW || !import.meta.env.DEV) {
// return
// }
const { worker } = await import('@/mocks/config')
return worker.start()
}
Expand Down
88 changes: 0 additions & 88 deletions src/pages/-calendar.tsx

This file was deleted.

Loading

0 comments on commit 847b61e

Please sign in to comment.