-
Notifications
You must be signed in to change notification settings - Fork 893
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
- Loading branch information
Showing
7 changed files
with
79 additions
and
62 deletions.
There are no files selected for viewing
27 changes: 11 additions & 16 deletions
27
.../js/src/dashboard/components/box-title.js → ...s/src/dashboard/components/alert-title.js
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,37 +1,32 @@ | ||
import { Title } from "@yoast/ui-library"; | ||
import { useContext } from "@wordpress/element"; | ||
import PropTypes from "prop-types"; | ||
import classNames from "classnames"; | ||
import { Title } from "@yoast/ui-library"; | ||
import { AlertsContext } from "../routes/alert-center"; | ||
|
||
/** | ||
* | ||
* @param {string} title The title of the card. | ||
* @param {number} counts The count of the card. | ||
* @param {string} Icon The icon of the card. | ||
* @param {string} iconColor The color of the icon. | ||
* | ||
* @returns {JSX.Element} The card title component. | ||
*/ | ||
export const BoxTitle = ( { | ||
title = "", | ||
export const AlertTitle = ( { | ||
title, | ||
counts = 0, | ||
Icon = "", | ||
iconColor = "red", | ||
} ) => { | ||
const colors = { | ||
red: "yst-text-red-500", | ||
blue: "yst-text-blue-500", | ||
}; | ||
const context = useContext( AlertsContext ); | ||
const Icon = context.Icon; | ||
|
||
return ( | ||
<div className="yst-flex yst-justify-between yst-gap-2 yst-items-center"> | ||
<Icon className={ classNames( "yst-w-6 yst-h-6", colors[ iconColor ] ) } /> | ||
<Title className="yst-grow" as="h3" size="2">{ title } { counts > 0 && `(${counts})` } </Title> | ||
<Icon className={ classNames( "yst-w-6 yst-h-6", context.iconClass ) } /> | ||
<Title className="yst-grow" as="h3" size="2">{ title } { counts > 0 && `(${counts})` }</Title> | ||
</div> | ||
); | ||
}; | ||
|
||
BoxTitle.propTypes = { | ||
AlertTitle.propTypes = { | ||
title: PropTypes.string, | ||
counts: PropTypes.number, | ||
Icon: PropTypes.elementType, | ||
iconColor: PropTypes.string, | ||
}; |
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 |
---|---|---|
@@ -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