added adminbar to layout
This commit is contained in:
1
utilities/canUseDOM.ts
Normal file
1
utilities/canUseDOM.ts
Normal file
@@ -0,0 +1 @@
|
||||
export default !!(typeof window !== 'undefined' && window.document && window.document.createElement)
|
||||
26
utilities/getURL.ts
Normal file
26
utilities/getURL.ts
Normal file
@@ -0,0 +1,26 @@
|
||||
import canUseDOM from './canUseDOM'
|
||||
|
||||
export const getServerSideURL = () => {
|
||||
return (
|
||||
process.env.NEXT_PUBLIC_SERVER_URL ||
|
||||
(process.env.VERCEL_PROJECT_PRODUCTION_URL
|
||||
? `https://${process.env.VERCEL_PROJECT_PRODUCTION_URL}`
|
||||
: 'http://localhost:3000')
|
||||
)
|
||||
}
|
||||
|
||||
export const getClientSideURL = () => {
|
||||
if (canUseDOM) {
|
||||
const protocol = window.location.protocol
|
||||
const domain = window.location.hostname
|
||||
const port = window.location.port
|
||||
|
||||
return `${protocol}//${domain}${port ? `:${port}` : ''}`
|
||||
}
|
||||
|
||||
if (process.env.VERCEL_PROJECT_PRODUCTION_URL) {
|
||||
return `https://${process.env.VERCEL_PROJECT_PRODUCTION_URL}`
|
||||
}
|
||||
|
||||
return process.env.NEXT_PUBLIC_SERVER_URL || ''
|
||||
}
|
||||
6
utilities/ui.ts
Normal file
6
utilities/ui.ts
Normal file
@@ -0,0 +1,6 @@
|
||||
import { type ClassValue, clsx } from 'clsx'
|
||||
import { twMerge } from 'tailwind-merge'
|
||||
|
||||
export function cn(...inputs: ClassValue[]) {
|
||||
return twMerge(clsx(inputs))
|
||||
}
|
||||
Reference in New Issue
Block a user