Skip to content

Commit

Permalink
resolve comments
Browse files Browse the repository at this point in the history
  • Loading branch information
hanbao-dev committed Feb 26, 2024
1 parent 7d9ec4a commit b78732d
Show file tree
Hide file tree
Showing 7 changed files with 57 additions and 25 deletions.
30 changes: 26 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@
"next": "14.1.0",
"next-mdx-remote": "^4.4.1",
"next-themes": "^0.2.1",
"prettier-plugin-organize-imports": "^3.2.4",
"pretty-quick": "^4.0.0",
"react": "^18",
"react-country-flag": "^3.1.0",
"react-dom": "^18",
Expand All @@ -54,6 +52,8 @@
"husky": "^9.0.11",
"postcss": "^8",
"prettier": "^3.2.5",
"prettier-plugin-organize-imports": "^3.2.4",
"pretty-quick": "^4.0.0",
"prettier-plugin-tailwindcss": "^0.5.11",
"tailwindcss": "^3.3.0",
"typescript": "^5"
Expand Down
5 changes: 3 additions & 2 deletions src/components/MobileNavigation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ import {
DrawerContent,
DrawerTrigger,
} from '@/components/ui/drawer'
import { Cross1Icon, HamburgerMenuIcon } from '@radix-ui/react-icons'
import { Cross1Icon } from '@radix-ui/react-icons'
import { RxHamburgerMenu } from 'react-icons/rx'

export function MobileNavigation() {
const [isDrawerOpen, setIsDrawerOpen] = React.useState(false)
Expand Down Expand Up @@ -41,7 +42,7 @@ export function MobileNavigation() {
variant='ghost'
onClick={() => setIsDrawerOpen(true)}
>
<HamburgerMenuIcon width='20' height='20'></HamburgerMenuIcon>
<RxHamburgerMenu className='h-6 w-6' />
</Button>
</DrawerTrigger>
<DrawerContent className='fixed bottom-0 left-0 mt-24 flex h-full w-screen flex-col rounded-t-[10px] '>
Expand Down
19 changes: 10 additions & 9 deletions src/components/Navigation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
navigationMenuTriggerStyle,
} from '@/components/ui/navigation-menu'
import { cn } from '@/lib/utils'
import { preventDefaultAction } from '@/utils'

const components: { title: string; href: string; description: string }[] = [
{
Expand All @@ -32,17 +33,17 @@ const components: { title: string; href: string; description: string }[] = [
export function NavigationMenuPage() {
return (
<NavigationMenu>
<NavigationMenuList className='pt-0'>
<NavigationMenuList>
<NavigationMenuItem>
<NavigationMenuTrigger
onPointerMove={(event) => event.preventDefault()}
onPointerLeave={(event) => event.preventDefault()}
onPointerMove={preventDefaultAction}
onPointerLeave={preventDefaultAction}
>
Discover
</NavigationMenuTrigger>
<NavigationMenuContent
onPointerMove={(event) => event.preventDefault()}
onPointerLeave={(event) => event.preventDefault()}
onPointerMove={preventDefaultAction}
onPointerLeave={preventDefaultAction}
>
<ul className='grid w-[400px] gap-3 p-4 md:w-[500px] md:grid-cols-2 lg:w-[600px] '>
{components.map((component) => (
Expand All @@ -59,14 +60,14 @@ export function NavigationMenuPage() {
</NavigationMenuItem>
<NavigationMenuItem>
<NavigationMenuTrigger
onPointerMove={(event) => event.preventDefault()}
onPointerLeave={(event) => event.preventDefault()}
onPointerMove={preventDefaultAction}
onPointerLeave={preventDefaultAction}
>
Recruit
</NavigationMenuTrigger>
<NavigationMenuContent
onPointerMove={(event) => event.preventDefault()}
onPointerLeave={(event) => event.preventDefault()}
onPointerMove={preventDefaultAction}
onPointerLeave={preventDefaultAction}
>
<ul className='grid gap-3 p-4 md:w-[400px] lg:w-[500px] lg:grid-cols-[.75fr_1fr]'>
<div className='row-span-3'>
Expand Down
7 changes: 7 additions & 0 deletions src/utils/get-date.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { format, subDays } from 'date-fns'

export const getDate = (sub: number = 0) => {
const dateXDaysAgo = subDays(new Date(), sub)

return format(dateXDaysAgo, 'dd/MM/yyyy')
}
10 changes: 2 additions & 8 deletions src/utils/index.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
import { format, subDays } from 'date-fns'

export const getDate = (sub: number = 0) => {
const dateXDaysAgo = subDays(new Date(), sub)

return format(dateXDaysAgo, 'dd/MM/yyyy')
}

export * from './fetcher'
export * from './get-date'
export * from './prevent-default'
7 changes: 7 additions & 0 deletions src/utils/prevent-default.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import React from 'react'

export const preventDefaultAction = <T extends React.SyntheticEvent>(
event: T
) => {
event.preventDefault()
}

0 comments on commit b78732d

Please sign in to comment.