Spaces:
Configuration error
Configuration error
File size: 4,286 Bytes
7bbd534 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 |
'use client';
/* eslint-disable */
// Chakra Imports
import {
Box,
Breadcrumb,
BreadcrumbItem,
BreadcrumbLink,
Flex,
Link,
useColorModeValue,
} from '@chakra-ui/react';
import { useState, useEffect } from 'react';
import AdminNavbarLinks from './NavbarLinksAdmin';
import { isWindowAvailable } from '@/utils/navigation';
export default function AdminNavbar(props: {
secondary: boolean;
brandText: string;
logoText: string;
onOpen: (...args: any[]) => any;
setApiKey: any;
}) {
const [scrolled, setScrolled] = useState(false);
useEffect(() => {
isWindowAvailable() && window.addEventListener('scroll', changeNavbar);
return () => {
isWindowAvailable() && window.removeEventListener('scroll', changeNavbar);
};
});
const { secondary, brandText, setApiKey } = props;
// Here are all the props that may change depending on navbar's type or state.(secondary, variant, scrolled)
let mainText = useColorModeValue('navy.700', 'white');
let secondaryText = useColorModeValue('gray.700', 'white');
let navbarPosition = 'fixed' as const;
let navbarFilter = 'none';
let navbarBackdrop = 'blur(20px)';
let navbarShadow = 'none';
let navbarBg = useColorModeValue(
'rgba(244, 247, 254, 0.2)',
'rgba(11,20,55,0.5)',
);
let navbarBorder = 'transparent';
let secondaryMargin = '0px';
let gap = '0px';
const changeNavbar = () => {
if (isWindowAvailable() && window.scrollY > 1) {
setScrolled(true);
} else {
setScrolled(false);
}
};
return (
<Box
zIndex="100"
position={navbarPosition}
boxShadow={navbarShadow}
bg={navbarBg}
borderColor={navbarBorder}
filter={navbarFilter}
backdropFilter={navbarBackdrop}
backgroundPosition="center"
backgroundSize="cover"
borderRadius="16px"
borderWidth="1.5px"
borderStyle="solid"
transitionDelay="0s, 0s, 0s, 0s"
transitionDuration=" 0.25s, 0.25s, 0.25s, 0s"
transition-property="box-shadow, background-color, filter, border"
transitionTimingFunction="linear, linear, linear, linear"
alignItems={{ xl: 'center' }}
display={secondary ? 'block' : 'flex'}
minH="75px"
justifyContent={{ xl: 'center' }}
lineHeight="25.6px"
mx="auto"
mt={secondaryMargin}
pb="8px"
right={{ base: '12px', md: '30px', lg: '30px', xl: '30px' }}
px={{
base: '8px',
md: '10px',
}}
ps={{
base: '8px',
md: '12px',
}}
pt="8px"
top={{ base: '12px', md: '16px', xl: '18px' }}
w={{
base: 'calc(100vw - 8%)',
md: 'calc(100vw - 8%)',
lg: 'calc(100vw - 6%)',
xl: 'calc(100vw - 350px)',
'2xl': 'calc(100vw - 365px)',
}}
>
<Flex
w="100%"
flexDirection={{
base: 'column',
md: 'row',
}}
alignItems={{ xl: 'center' }}
mb={gap}
>
<Box mb={{ base: '8px', md: '0px' }}>
<Breadcrumb>
<BreadcrumbItem color={secondaryText} fontSize="sm" mb="5px">
<BreadcrumbLink href="#" color={secondaryText}>
Pages
</BreadcrumbLink>
</BreadcrumbItem>
<BreadcrumbItem color={secondaryText} fontSize="sm">
<BreadcrumbLink href="#" color={secondaryText}>
{brandText}
</BreadcrumbLink>
</BreadcrumbItem>
</Breadcrumb>
{/* Here we create navbar brand, based on route name */}
<Link
color={mainText}
href="#"
bg="inherit"
borderRadius="inherit"
fontWeight="bold"
fontSize="34px"
p="0px"
_hover={{ color: { mainText } }}
_active={{
bg: 'inherit',
transform: 'none',
borderColor: 'transparent',
}}
_focus={{
boxShadow: 'none',
}}
>
{brandText}
</Link>
</Box>
<Box ms="auto" w={{ sm: '100%', md: 'unset' }}>
<AdminNavbarLinks setApiKey={setApiKey} secondary={props.secondary} />
</Box>
</Flex>
</Box>
);
}
|