diff --git a/.changeset/late-rice-crash.md b/.changeset/late-rice-crash.md new file mode 100644 index 0000000000..b692310c01 --- /dev/null +++ b/.changeset/late-rice-crash.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-home': patch +--- + +Fixed regression that caused the `WelcomeTitle` to not be the right size when passed to the `title` property of the `
` component. A Storybook entry was also added for the `WelcomeTitle` diff --git a/plugins/home/src/homePageComponents/WelcomeTitle/WelcomeTitle.stories.tsx b/plugins/home/src/homePageComponents/WelcomeTitle/WelcomeTitle.stories.tsx new file mode 100644 index 0000000000..ddcce2fe41 --- /dev/null +++ b/plugins/home/src/homePageComponents/WelcomeTitle/WelcomeTitle.stories.tsx @@ -0,0 +1,29 @@ +/* + * Copyright 2023 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { Header } from '@backstage/core-components'; +import { wrapInTestApp } from '@backstage/test-utils'; +import React, { ComponentType } from 'react'; +import { WelcomeTitle } from './WelcomeTitle'; + +export default { + title: 'Plugins/Home/Components/WelcomeTitle', + decorators: [(Story: ComponentType<{}>) => wrapInTestApp()], +}; + +export const Default = () => { + return
} pageTitleOverride="Home" />; +}; diff --git a/plugins/home/src/homePageComponents/WelcomeTitle/WelcomeTitle.tsx b/plugins/home/src/homePageComponents/WelcomeTitle/WelcomeTitle.tsx index 1d2f3d672a..49ae38d90c 100644 --- a/plugins/home/src/homePageComponents/WelcomeTitle/WelcomeTitle.tsx +++ b/plugins/home/src/homePageComponents/WelcomeTitle/WelcomeTitle.tsx @@ -18,8 +18,7 @@ import { identityApiRef, useApi, } from '@backstage/core-plugin-api'; -import { Tooltip } from '@material-ui/core'; -import Typography from '@material-ui/core/Typography'; +import { Tooltip, Typography } from '@material-ui/core'; import React, { useEffect, useMemo } from 'react'; import useAsync from 'react-use/lib/useAsync'; import { getTimeBasedGreeting } from './timeUtil'; @@ -44,7 +43,7 @@ export const WelcomeTitle = () => { return ( - {`${greeting.greeting}${ + {`${greeting.greeting}${ profile?.displayName ? `, ${profile?.displayName}` : '' }!`}