change ovalStart to vowelStart, add default value, add proptypes and JSdoc

This commit is contained in:
Alex Holliday committed 2024-12-03 11:00:21 +08:00
1 parent 0e8bccfea1
commit 74251a9801
1 file changed
+4 -3
+4 -3
View File
@@ -16,11 +16,11 @@ import "./index.css";
* @param {string} props.title - The title to be displayed in the fallback UI. * @param {string} props.title - The title to be displayed in the fallback UI.
* @param {Array<string>} props.checks - An array of strings representing the checks to display. * @param {Array<string>} props.checks - An array of strings representing the checks to display.
* @param {string} [props.link="/"] - The link to navigate to. * @param {string} [props.link="/"] - The link to navigate to.
* * @param {boolean} [props.vowelStart=false] - Whether the title starts with a vowel.
* @returns {JSX.Element} The rendered fallback UI. * @returns {JSX.Element} The rendered fallback UI.
*/ */
const Fallback = ({ title, checks, link = "/", isAdmin, ovalStart }) => { const Fallback = ({ title, checks, link = "/", isAdmin, vowelStart = false }) => {
const theme = useTheme(); const theme = useTheme();
const navigate = useNavigate(); const navigate = useNavigate();
const mode = useSelector((state) => state.ui.mode); const mode = useSelector((state) => state.ui.mode);
@@ -56,7 +56,7 @@ const Fallback = ({ title, checks, link = "/", isAdmin, ovalStart }) => {
marginY={theme.spacing(4)} marginY={theme.spacing(4)}
color={theme.palette.text.tertiary} color={theme.palette.text.tertiary}
> >
{ovalStart ? "An" : "A"} {title} is used to: {vowelStart ? "An" : "A"} {title} is used to:
</Typography> </Typography>
{checks.map((check, index) => ( {checks.map((check, index) => (
<Check <Check
@@ -86,6 +86,7 @@ Fallback.propTypes = {
checks: PropTypes.arrayOf(PropTypes.string).isRequired, checks: PropTypes.arrayOf(PropTypes.string).isRequired,
link: PropTypes.string, link: PropTypes.string,
isAdmin: PropTypes.bool, isAdmin: PropTypes.bool,
vowelStart: PropTypes.bool,
}; };
export default Fallback; export default Fallback;