Skip to content

Commit

Permalink
Merge pull request #129 from dappforce/deploy/tailwind
Browse files Browse the repository at this point in the history
Fix issue where creators page get rendered without css for fraction of second
  • Loading branch information
teodorus-nathaniel authored Dec 22, 2023
2 parents 046a330 + 7aaf3bb commit fd9d525
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 39 deletions.
37 changes: 37 additions & 0 deletions src/layout/DefaultNav.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import { useSidebarCollapsed } from '@/components/providers/SideBarCollapsedContext'
import { Drawer } from 'antd'
import clsx from 'clsx'
import dynamic from 'next/dynamic'
import { useRouter } from 'next/router'
import { FunctionComponent, useEffect } from 'react'

const Menu = dynamic(() => import('./SideMenu'), { ssr: false })

const DefaultNav: FunctionComponent<{ className?: string }> = ({
className,
}) => {
const {
state: { collapsed },
hide,
} = useSidebarCollapsed()
const { asPath } = useRouter()

useEffect(() => hide(), [ asPath ])

return (
<Drawer
className={clsx('DfSideBar h-100', className)}
bodyStyle={{ padding: 0 }}
placement='left'
closable={false}
onClose={hide}
visible={!collapsed}
getContainer={false}
keyboard
>
<Menu />
</Drawer>
)
}

export default DefaultNav
20 changes: 20 additions & 0 deletions src/layout/HomeNav.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import Sider from 'antd/lib/layout/Sider'
import dynamic from 'next/dynamic'

const Menu = dynamic(() => import('./SideMenu'), { ssr: false })

const HomeNav = () => {
return (
<Sider
className='DfSider'
width='230'
trigger={null}
collapsible
collapsed={true}
>
<Menu />
</Sider>
)
}

export default HomeNav
40 changes: 5 additions & 35 deletions src/layout/Navigation.tsx
Original file line number Diff line number Diff line change
@@ -1,51 +1,21 @@
import React, { FunctionComponent, useEffect, useMemo } from 'react'
import { Layout, Drawer } from 'antd'
import React, { useMemo } from 'react'
import { Layout } from 'antd'
import { useSidebarCollapsed } from '../components/providers/SideBarCollapsedContext'
import { useRouter } from 'next/router'
import clsx from 'clsx'
import dynamic from 'next/dynamic'
import styles from './Sider.module.sass'
import { useCurrentAccount } from '../components/providers/MyExtensionAccountsContext'

const DefaultNav = dynamic(() => import('./DefaultNav'), { ssr: false })
const HomeNav = dynamic(() => import('./HomeNav'), { ssr: false })
const TopMenu = dynamic(() => import('../components/topMenu/TopMenu'), { ssr: false })
const Menu = dynamic(() => import('./SideMenu'), { ssr: false })

const { Sider, Content } = Layout
const { Content } = Layout
interface Props {
children: React.ReactNode
}

const HomeNav = () => {
return <Sider
className='DfSider'
width='230'
trigger={null}
collapsible
collapsed={true}
>
<Menu />
</Sider>
}

const DefaultNav: FunctionComponent<{ className?: string }> = ({ className }) => {
const { state: { collapsed }, hide } = useSidebarCollapsed()
const { asPath } = useRouter()

useEffect(() => hide(), [ asPath ])

return <Drawer
className={clsx('DfSideBar h-100', className)}
bodyStyle={{ padding: 0 }}
placement='left'
closable={false}
onClose={hide}
visible={!collapsed}
getContainer={false}
keyboard
>
<Menu />
</Drawer>
}

const Navigation = (props: Props): JSX.Element => {
const { children } = props
Expand Down
11 changes: 7 additions & 4 deletions src/layout/NextLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,14 @@ import { MINUTES } from '../components/utils/index'
import dynamic from 'next/dynamic'
import AnalyticProvider from 'src/components/providers/AnalyticContext'
import { ChatContextWrapper } from 'src/components/providers/ChatContext'
import Navigation from './Navigation'

const Navigation = dynamic(() => import('./Navigation'), { ssr: false })
const ChatFloatingModal = dynamic(() => import('src/components/chat/ChatFloatingModal'), {
ssr: false
})
const ChatFloatingModal = dynamic(
() => import('src/components/chat/ChatFloatingModal'),
{
ssr: false,
}
)

const Page: React.FunctionComponent = ({ children }) => (
<>
Expand Down

0 comments on commit fd9d525

Please sign in to comment.