-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5354 from Automattic/add/theme-sheet-selector
Themes: Add site-selector modal to theme sheet
- Loading branch information
Showing
10 changed files
with
73 additions
and
20 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
/** @ssr-ready **/ | ||
|
||
/** | ||
* Internal dependencies | ||
*/ | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,25 @@ | ||
/** @ssr-ready **/ | ||
|
||
export function getThemeDetails( state, id ) { | ||
const theme = state.themes.themeDetails.get( id ); | ||
return theme ? theme.toJS() : {}; | ||
let theme = state.themes.themeDetails.get( id ); | ||
theme = theme ? theme.toJS() : {}; | ||
if ( theme.price ) { | ||
theme.price = formatPrice( theme.price ); | ||
} | ||
return theme; | ||
} | ||
|
||
// Convert price to format used by v1.2 themes API to fit with existing components. | ||
// TODO (seear): remove when v1.2 theme details endpoint is added | ||
function formatPrice( price ) { | ||
if ( price.value === 0 ) { | ||
// Free themes have plaintext string | ||
return price.display; | ||
} | ||
// Premium themes have markup in price.display, so create our own plaintext | ||
return price.value.toLocaleString( 'default', { | ||
style: 'currency', | ||
currency: price.currency, | ||
minimumFractionDigits: 0, | ||
} ); | ||
} |
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