Skip to content

Commit 621c6f6

Browse files
author
Erik Hanchett
committed
Updated names based on code review
1 parent 5ddd7e3 commit 621c6f6

File tree

6 files changed

+13
-19
lines changed

6 files changed

+13
-19
lines changed

mdx-components.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import * as React from 'react';
22
import type { MDXComponents } from 'mdx/types';
33
import ExportedImage from 'next-image-export-optimizer';
4-
import { Banner } from './src/components/Banner';
4+
import { AIBanner } from './src/components/AIBanner';
55
import InlineFilter from './src/components/InlineFilter';
66
import { YoutubeEmbed } from './src/components/YoutubeEmbed';
77
import { Accordion } from './src/components/Accordion';
@@ -65,7 +65,7 @@ export function useMDXComponents(components: MDXComponents): MDXComponents {
6565
InlineFilter,
6666
MigrationAlert,
6767
YoutubeEmbed,
68-
Banner,
68+
AIBanner,
6969
Overview,
7070
ExternalLink,
7171
ExternalLinkButton,

src/components/Banner/Banner.tsx renamed to src/components/AIBanner/AIBanner.tsx

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,8 @@ import { Flex, Message, IconsProvider, Text } from '@aws-amplify/ui-react';
22
import { IconStar, IconChevron } from '../Icons';
33
import { Button } from '@aws-amplify/ui-react';
44

5-
interface BannerProps {
6-
url?: string;
7-
}
8-
9-
export const Banner: React.FC<BannerProps> = ({
10-
url = '/react/ai/set-up-ai/'
11-
}) => {
5+
export const AIBanner: React.FC = () => {
6+
const URL = '/react/ai/set-up-ai/';
127
return (
138
<IconsProvider
149
icons={{
@@ -31,10 +26,9 @@ export const Banner: React.FC<BannerProps> = ({
3126

3227
<Button
3328
as="a"
34-
href={url}
29+
href={URL}
3530
size="small"
3631
gap="small"
37-
target="_blank"
3832
colorTheme="overlay"
3933
rel="noopener noreferrer"
4034
className="message-banner__button"

src/components/Banner/__tests__/Banner.test.tsx renamed to src/components/AIBanner/__tests__/AIBanner.test.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import * as React from 'react';
22
import { render, screen } from '@testing-library/react';
3-
import { Banner } from '../index';
3+
import { AIBanner } from '../index';
44

5-
describe('Banner', () => {
6-
it('should render the Banner component', async () => {
5+
describe('AIBanner', () => {
6+
it('should render the AIBanner component', async () => {
77
const bannerText = 'Amplify AI kit is now generally available';
8-
render(<Banner />);
8+
render(<AIBanner />);
99

1010
const component = await screen.findByText(bannerText);
1111
expect(component).toBeInTheDocument();

src/components/AIBanner/index.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export { AIBanner } from './AIBanner';

src/components/Banner/index.tsx

Lines changed: 0 additions & 1 deletion
This file was deleted.

src/components/Layout/Layout.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ import type { HeadingInterface } from '@/components/TableOfContents/TableOfConte
2929
import { Breadcrumbs } from '@/components/Breadcrumbs';
3030
import { debounce } from '@/utils/debounce';
3131
import '@docsearch/css';
32-
import { Banner } from '@/components/Banner';
32+
import { AIBanner } from '@/components/AIBanner';
3333
import { usePathWithoutHash } from '@/utils/usePathWithoutHash';
3434
import {
3535
NextPrevious,
@@ -72,7 +72,7 @@ export const Layout = ({
7272
const basePath = 'docs.amplify.aws';
7373
const metaUrl = url ? url : basePath + asPathWithNoHash;
7474
const pathname = router.pathname;
75-
const shouldShowGen2Banner = asPathWithNoHash === '/';
75+
const shouldShowAIBanner = asPathWithNoHash === '/';
7676
const isGen1 = asPathWithNoHash.split('/')[1] === 'gen1';
7777
const isContributor = asPathWithNoHash.split('/')[1] === 'contribute';
7878
const currentGlobalNavMenuItem = isContributor ? 'Contribute' : 'Docs';
@@ -274,7 +274,7 @@ export const Layout = ({
274274
platform={currentPlatform}
275275
/>
276276
) : null}
277-
{shouldShowGen2Banner ? <Banner /> : null}
277+
{shouldShowAIBanner ? <AIBanner /> : null}
278278
{useCustomTitle ? null : (
279279
<Heading level={1}>{pageTitle}</Heading>
280280
)}

0 commit comments

Comments
 (0)