Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Design Picker: Include premium themes (#59293)
* Add PremiumBadge component * Only fetch free themes if the premium themes are not available to user * Apply PremiumBadge to Design Picker of Gutenboarding * Adjust delay of Tooltip * Refactor useSelector usage to follow best practice * Update copy of tooltip * Change to use planHasFeature * Return array from useSelector * Rollback the change of getRecommendedThemes * Fix ts error * Move planHasFeature out of useSelector * Use theme demo API v1.1 * Use stylesheet if possible * Update tests * Test situation where the design config info is missing stylesheet Co-authored-by: Philip Jackson <p-jackson@live.com>
- Loading branch information
1 parent
3478ea4
commit 4b4cae6
Showing
12 changed files
with
138 additions
and
77 deletions.
There are no files selected for viewing
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
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
35 changes: 35 additions & 0 deletions
35
packages/design-picker/src/components/premium-badge/index.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,35 @@ | ||
import { Gridicon } from '@automattic/components'; | ||
import { Tooltip } from '@wordpress/components'; | ||
import { useI18n } from '@wordpress/react-i18n'; | ||
import classNames from 'classnames'; | ||
import type { FunctionComponent } from 'react'; | ||
|
||
import './style.scss'; | ||
|
||
interface Props { | ||
className?: string; | ||
} | ||
|
||
const PremiumBadge: FunctionComponent< Props > = ( { className } ) => { | ||
const { __ } = useI18n(); | ||
|
||
return ( | ||
<Tooltip | ||
position="top center" | ||
// @ts-expect-error: @types/wordpress__components doesn't align with latest @wordpress/components | ||
delay={ 300 } | ||
text={ __( | ||
'Let your site stand out from the crowd with a modern and stylish Premium theme.', | ||
__i18n_text_domain__ | ||
) } | ||
> | ||
<div className={ classNames( 'premium-badge', className ) }> | ||
{ /* eslint-disable-next-line wpcalypso/jsx-gridicon-size */ } | ||
<Gridicon className="premium-badge__logo" icon="star" size={ 14 } /> | ||
<span>{ __( 'Premium' ) }</span> | ||
</div> | ||
</Tooltip> | ||
); | ||
}; | ||
|
||
export default PremiumBadge; |
37 changes: 37 additions & 0 deletions
37
packages/design-picker/src/components/premium-badge/style.scss
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,37 @@ | ||
.premium-badge { | ||
display: inline-flex; | ||
align-items: center; | ||
height: 20px; | ||
line-height: 20px; | ||
padding: 0 10px 0 9px; | ||
border-radius: 20px; /* stylelint-disable-line scales/radii */ | ||
margin-left: 10px; | ||
box-sizing: border-box; | ||
font-size: 0.75rem; | ||
color: var( --studio-white ); | ||
background: var( --studio-black ); | ||
z-index: 1; | ||
|
||
.design-picker .design-picker__option-meta & { | ||
min-height: 0; | ||
} | ||
|
||
.premium-badge__logo { | ||
margin-top: -1px; | ||
margin-right: 3px; | ||
} | ||
|
||
.components-tooltip .components-popover__content { | ||
border-radius: 4px; | ||
margin: 8px; | ||
background-color: var( --studio-gray-100 ); | ||
white-space: pre-line; | ||
|
||
> div { | ||
max-width: 300px; | ||
width: max-content; | ||
padding: 8px 10px; | ||
text-align: start; | ||
} | ||
} | ||
} |
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
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
Oops, something went wrong.