-
Notifications
You must be signed in to change notification settings - Fork 243
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- adding a `FeedNav` at the top of the feed layout - updating footer nav items - moving reading streaks to the top of the `for you` feed TODO: - go through all pages and make sure the layout is not broken - validate the previous layout still looks the same if the feature flag is disabled
- Loading branch information
1 parent
7a30463
commit ce3f16b
Showing
9 changed files
with
238 additions
and
112 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import classNames from 'classnames'; | ||
import React, { ReactElement, useMemo } from 'react'; | ||
import { useRouter } from 'next/router'; | ||
import { Tab, TabContainer } from '../tabs/TabContainer'; | ||
import NotificationsBell from '../notifications/NotificationsBell'; | ||
|
||
enum FeedNavTab { | ||
ForYou = 'For you', | ||
Popular = 'Popular', | ||
Bookmarks = 'Bookmarks', | ||
History = 'History', | ||
} | ||
|
||
function FeedNav(): ReactElement { | ||
const router = useRouter(); | ||
const shouldRenderNav = useMemo(() => { | ||
return /(\/|\/popular|\/bookmarks|\/history|\/notifications)$/.test( | ||
router?.pathname, | ||
); | ||
}, [router?.pathname]); | ||
|
||
if (!shouldRenderNav) { | ||
return null; | ||
} | ||
|
||
return ( | ||
<div | ||
className={classNames( | ||
'sticky top-0 z-header h-14 w-full bg-background-default tablet:pl-16', | ||
)} | ||
> | ||
<TabContainer | ||
shouldMountInactive | ||
className={{ | ||
header: 'no-scrollbar overflow-x-auto px-1', | ||
}} | ||
tabListProps={{ className: { indicator: '!w-6' } }} | ||
> | ||
<Tab label={FeedNavTab.ForYou} url="/" /> | ||
<Tab label={FeedNavTab.Popular} url="/popular" /> | ||
<Tab label={FeedNavTab.Bookmarks} url="/bookmarks" /> | ||
<Tab label={FeedNavTab.History} url="/history" /> | ||
</TabContainer> | ||
|
||
<div className="fixed right-0 top-0 my-1 flex h-12 w-36 items-center justify-end bg-gradient-to-r from-transparent via-background-default via-60% to-background-default"> | ||
<NotificationsBell /> | ||
</div> | ||
</div> | ||
); | ||
} | ||
|
||
export default FeedNav; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.