-
Notifications
You must be signed in to change notification settings - Fork 885
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor comment clear property feat: deconstruct context feat: restore styling feat: add safety check for deconstructing the context fix padding in collapsible fix js doc comment fix margin fix collapsable
- Loading branch information
Showing
8 changed files
with
105 additions
and
88 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { useContext } from "@wordpress/element"; | ||
import PropTypes from "prop-types"; | ||
import classNames from "classnames"; | ||
import { ExclamationCircleIcon } from "@heroicons/react/outline"; | ||
import { Title } from "@yoast/ui-library"; | ||
import { AlertsContext } from "../routes/alert-center"; | ||
|
||
/** | ||
* | ||
* @param {string} title The title of alerts. | ||
* @param {number} counts The count of the alerts. | ||
* | ||
* @returns {JSX.Element} The alert title element. | ||
*/ | ||
export const AlertTitle = ( { | ||
title, | ||
counts = 0, | ||
} ) => { | ||
const { Icon = ExclamationCircleIcon, iconClass = "" } = useContext( AlertsContext ); | ||
|
||
return ( | ||
<div className="yst-flex yst-justify-between yst-gap-2 yst-items-center"> | ||
<Icon className={ classNames( "yst-w-6 yst-h-6", iconClass ) } /> | ||
<Title className="yst-grow" as="h3" size="2">{ title } { counts > 0 && `(${counts})` }</Title> | ||
</div> | ||
); | ||
}; | ||
|
||
AlertTitle.propTypes = { | ||
title: PropTypes.string, | ||
counts: PropTypes.number, | ||
}; |
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 was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
export { default as RouteLayout } from "./route-layout"; | ||
export { Notifications } from "./notifications"; | ||
export { Problems } from "./problems"; | ||
export { List } from "./list"; | ||
export { BoxTitle } from "./box-title"; | ||
export { HiddenAlertsCollapsible } from "./hidden-alerts-collapsible"; | ||
export { AlertsList } from "./alerts-list"; | ||
export { AlertTitle } from "./alert-title"; | ||
export { Collapsible } from "./collapsible"; |
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