MCPcopy Create free account
hub / github.com/code100x/daily-code / renderBlogAppbar

Function renderBlogAppbar

apps/web/components/BlogAppbar.tsx:126–251  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

124 );
125
126 const renderBlogAppbar = () =>
127 isLegacyMode ? (
128 <div
129 className={`sticky top-0 z-50 flex w-full flex-col items-center justify-between gap-4 border-b bg-zinc-50 p-4 shadow-md transition-transform duration-300 md:gap-0 dark:bg-zinc-950 ${
130 !visible && scrollingDown ? "-translate-y-full transform" : " "
131 }`}
132 style={{ transform: !visible && !scrollingDown ? "translateY(0)" : "" }}
133 >
134 <div className="mr-2 flex w-full flex-col items-center sm:gap-2 md:flex-row md:items-center md:justify-between">
135 <div className="mb-2 text-3xl font-semibold text-zinc-950 md:mb-0 dark:text-zinc-100">
136 <Link href={"/"}>DailyCode</Link>
137 </div>
138
139 <p className="ml-2 hidden flex-1 items-center justify-center font-medium md:flex">
140 {track.title} ({problemIndex + 1} / {track.problems.length})
141 </p>
142 <div className="flex items-center space-x-2">
143 <CustomPagination allProblems={track.problems} isAtHeader track={track} problemIndex={problemIndex} />
144 <ModeToggle />
145 <Link href={`/pdf/${track.id}/${track.problems[problemIndex]!.id}`} target="_blank">
146 <Button variant="outline" className="ml-2 hidden bg-black text-white md:flex">
147 {/* Don't think this is required and its cluttering the AppBar at the top. Uncomment this if its required */}
148 {/* Download */}
149 <DownloadIcon />
150 </Button>
151 <Button variant="outline" className="block bg-black text-white md:hidden">
152 <div>
153 <DownloadIcon />
154 </div>
155 </Button>
156 </Link>
157 {renderUIModeToggleButton()}
158 <UserAccountDropDown />
159 </div>
160 </div>
161
162 <p className="ml-2 flex w-full flex-1 items-center justify-center border-t bg-opacity-60 pt-2 text-center font-medium md:hidden">
163 {track.title} ({problemIndex + 1} / {track.problems.length})
164 </p>
165 </div>
166 ) : (
167 <>
168 <motion.div
169 className={`z-[50] flex w-full flex-col justify-between gap-2 p-6 md:flex-row ${visible ? "translate-y-0" : "-translate-y-full"}`}
170 initial={{ y: 0 }}
171 animate={{ y: visible ? 0 : -100 }}
172 transition={{ duration: 0.3 }}
173 >
174 <div className="flex items-center gap-2">
175 {/* menu */}
176 <div
177 onClick={() => setIsOpen(!isOpen)}
178 className="text-primary border-primary/10 flex cursor-pointer items-center gap-4 rounded-lg border bg-black/10 p-3 backdrop-blur-lg"
179 >
180 {isOpen ? <X className="size-6" /> : <Menu className="size-6" />}
181 </div>
182 {/* track title */}
183 <motion.div

Callers 1

BlogAppbarFunction · 0.85

Calls 2

renderUIModeToggleButtonFunction · 0.85
renderTopicsFunction · 0.85

Tested by

no test coverage detected