-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
NTP: UI Privacy Stats spacing and secondary expansion (#1270)
* chore: Update Privacy stats view * chore: Modify the showHide button * chore: FInalize button and spacing in card * fix: lint * fix: Making sure round buttons stay round * fix: Line height for empty subtitle * chore: Move rowmax to a const * chore: Markup cleanpu
- Loading branch information
1 parent
80c4a7b
commit bcf726e
Showing
5 changed files
with
117 additions
and
48 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
23 changes: 18 additions & 5 deletions
23
special-pages/pages/new-tab/app/components/ShowHideButton.jsx
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 |
---|---|---|
@@ -1,21 +1,34 @@ | ||
import styles from './ShowHide.module.css'; | ||
import cn from 'classnames'; | ||
import { ChevronButton } from './Icons.js'; | ||
import { h } from 'preact'; | ||
import { ChevronButton, Chevron } from './Icons.js'; | ||
import { Fragment, h } from 'preact'; | ||
|
||
/** | ||
* Function to handle showing or hiding content based on certain conditions. | ||
* | ||
* @param {Object} props - Input parameters for controlling the behavior of the ShowHide functionality. | ||
* @param {string} props.text | ||
* @param {boolean} [props.showText] | ||
* @param {() => void} props.onClick | ||
* @param {'none'|'round'} [props.shape] | ||
* @param {import("preact").ComponentProps<'button'>} [props.buttonAttrs] | ||
*/ | ||
export function ShowHideButton({ text, onClick, buttonAttrs = {}, shape = 'none' }) { | ||
export function ShowHideButton({ text, onClick, buttonAttrs = {}, shape = 'none', showText = false }) { | ||
return ( | ||
<button {...buttonAttrs} class={cn(styles.button, shape === 'round' && styles.round)} aria-label={text} onClick={onClick}> | ||
<ChevronButton /> | ||
<button | ||
{...buttonAttrs} | ||
class={cn(styles.button, shape === 'round' && styles.round, !!showText && styles.withText)} | ||
aria-label={text} | ||
onClick={onClick} | ||
> | ||
{showText ? ( | ||
<Fragment> | ||
<Chevron /> | ||
{text} | ||
</Fragment> | ||
) : ( | ||
<ChevronButton /> | ||
)} | ||
</button> | ||
); | ||
} |
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