-
Notifications
You must be signed in to change notification settings - Fork 869
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* Migrate article channel names Hide sidebar on small screens PoC sidebar Lazy load sidebar Fix background Fix ad link Add articles with no images Create top bar Styling improvements Sidebar color tweaks Sidebar color tweaks Make buttons nicer * Same top level headings * Remove sidebar title * Monochrome news icon on peeking card * Fix peek button not showing on empty feeds * Heading cleanup
- Loading branch information
1 parent
1f704ec
commit a1313ea
Showing
12 changed files
with
219 additions
and
93 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
60 changes: 60 additions & 0 deletions
60
components/brave_new_tab_ui/components/default/braveNews/SidebarMenu.tsx
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,60 @@ | ||
// Copyright (c) 2024 The Brave Authors. All rights reserved. | ||
// This Source Code Form is subject to the terms of the Mozilla Public | ||
// License, v. 2.0. If a copy of the MPL was not distributed with this file, | ||
// You can obtain one at https://mozilla.org/MPL/2.0/. | ||
|
||
import * as React from 'react'; | ||
import styled from 'styled-components'; | ||
import FeedNavigation from '../../../../brave_news/browser/resources/FeedNavigation'; | ||
import SettingsButton from '../../../../brave_news/browser/resources/SettingsButton'; | ||
import Icon from '@brave/leo/react/icon'; | ||
|
||
const Container = styled.dialog` | ||
top: var(--bn-top-bar-height); | ||
height: calc(100vh - var(--bn-top-bar-height)); | ||
overflow: hidden; | ||
margin-left: 0; | ||
margin-top: 0; | ||
padding: 0; | ||
position: fixed; | ||
display: flex; | ||
transition: transform 0.2s ease-in-out; | ||
transform: translateX(-100%); | ||
background: var(--bn-glass-card); | ||
backdrop-filter: blur(64px); | ||
border: none; | ||
outline: none; | ||
&[open] { | ||
transform: translateX(0); | ||
} | ||
&> div { | ||
background: unset; | ||
} | ||
` | ||
|
||
const MenuButton = styled(SettingsButton)` | ||
margin-right: auto; | ||
` | ||
|
||
export default function SidebarMenu() { | ||
const dialogRef = React.useRef<HTMLDialogElement>() | ||
return <MenuButton onClick={() => dialogRef.current?.showModal()}> | ||
<Icon name="hamburger-menu" /> | ||
<Container ref={dialogRef as any} onClick={e => { | ||
// Close the menu on click outside. | ||
const bounds = e.currentTarget.getBoundingClientRect() | ||
if (e.clientX < bounds.x || e.clientY < bounds.y || e.clientX > bounds.right || e.clientY > bounds.bottom) { | ||
e.currentTarget.close() | ||
} | ||
}}> | ||
<FeedNavigation /> | ||
</Container> | ||
</MenuButton> | ||
} |
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
Oops, something went wrong.