-
Notifications
You must be signed in to change notification settings - Fork 801
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Extract and move the UpsellBanner component to js-packages/components…
… (2/3) (#35228) * changelog * Remove unneeded changelog * Move UpsellBanner component to js-packages/components. * In JetpackManageBanner import UpsellBanner from @automattic/jetpack-components * Update the Jetpack Manage Banner copy. * changelog * Rewrite the UpsellBanner component into TypeScript * Add the UpsellBanner storybook * Remove the UpsellBanner component from packages/my-jetpack * Remove the UpsellBanner component from packages/my-jetpack * Update package version
- Loading branch information
Showing
13 changed files
with
122 additions
and
11 deletions.
There are no files selected for viewing
4 changes: 4 additions & 0 deletions
4
...ects/js-packages/components/changelog/update-move-upsell-banner-componen-to-js-components
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,4 @@ | ||
Significance: minor | ||
Type: changed | ||
|
||
Move the UpsellBanner component to js-packages/components |
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
5 changes: 5 additions & 0 deletions
5
projects/js-packages/components/components/upsell-banner/stories/declarations.d.ts
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,5 @@ | ||
declare module '*.svg' { | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
const content: any; | ||
export default content; | ||
} |
75 changes: 75 additions & 0 deletions
75
projects/js-packages/components/components/upsell-banner/stories/index.stories.tsx
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,75 @@ | ||
import UpsellBanner from '..'; | ||
import logoSample from './jetpack-manage.svg'; | ||
|
||
export default { | ||
title: 'JS Packages/Components/Upsell Banner', | ||
component: UpsellBanner, | ||
parameters: { | ||
layout: 'centered', | ||
}, | ||
}; | ||
|
||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
const BannerTemplate = args => { | ||
// Set up the first CTA | ||
const secondaryCtaLabel = 'Learn more'; | ||
const secondaryCtaUrl = 'my-jetpack-jetpack-manage-learn-more'; | ||
|
||
// Set up the second CTA | ||
const primaryCtaLabel = 'Manage sites'; | ||
const primaryCtaUrl = 'my-jetpack-jetpack-manage-dashboard'; | ||
|
||
return ( | ||
<UpsellBanner | ||
icon={ args.showIcon ? logoSample : null } | ||
title="Jetpack Manage" | ||
description="Jetpack Manage has the tools you need to manage multiple WordPress sites. Monitor site security, performance, and traffic, and get alerted if a site needs attention. Plus, get bulk discounts." | ||
secondaryCtaLabel={ args.showSecondary ? secondaryCtaLabel : null } | ||
secondaryCtaURL={ args.showSecondary ? secondaryCtaUrl : null } | ||
secondaryCtaIsExternalLink={ true } | ||
primaryCtaLabel={ args.showPrimary ? primaryCtaLabel : null } | ||
primaryCtaURL={ args.showPrimary ? primaryCtaUrl : null } | ||
primaryCtaIsExternalLink={ true } | ||
/> | ||
); | ||
}; | ||
|
||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
export const CompleteBanner = args => { | ||
const props = { | ||
showIcon: true, | ||
showSecondary: true, | ||
showPrimary: true, | ||
}; | ||
return <BannerTemplate { ...props } />; | ||
}; | ||
|
||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
export const WithoutIcon = args => { | ||
const props = { | ||
showIcon: false, | ||
showSecondary: true, | ||
showPrimary: true, | ||
}; | ||
return <BannerTemplate { ...props } />; | ||
}; | ||
|
||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
export const WithoutPrimaryBtn = args => { | ||
const props = { | ||
showIcon: true, | ||
showSecondary: true, | ||
showPrimary: false, | ||
}; | ||
return <BannerTemplate { ...props } />; | ||
}; | ||
|
||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
export const WithoutSecondaryBtn = args => { | ||
const props = { | ||
showIcon: true, | ||
showSecondary: false, | ||
showPrimary: true, | ||
}; | ||
return <BannerTemplate { ...props } />; | ||
}; |
File renamed without changes
File renamed without changes.
13 changes: 13 additions & 0 deletions
13
projects/js-packages/components/components/upsell-banner/types.ts
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,13 @@ | ||
export type UpsellBannerProps = { | ||
icon?: string; | ||
title: string; | ||
description: string; | ||
primaryCtaLabel?: string; | ||
primaryCtaURL?: string; | ||
primaryCtaIsExternalLink?: boolean; | ||
primaryCtaOnClick?: () => void; | ||
secondaryCtaLabel?: string; | ||
secondaryCtaURL?: string; | ||
secondaryCtaIsExternalLink?: boolean; | ||
secondaryCtaOnClick?: () => void; | ||
}; |
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
10 changes: 10 additions & 0 deletions
10
...ts/packages/my-jetpack/_inc/components/jetpack-manage-banner/jetpack-manage.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
4 changes: 4 additions & 0 deletions
4
projects/packages/my-jetpack/changelog/update-move-upsell-banner-componen-to-js-components
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,4 @@ | ||
Significance: minor | ||
Type: removed | ||
|
||
UpsellBanner component moved to js-packages/components |