Skip to content

Commit

Permalink
Themes Marketplace: Add external icon to the "Preview demo site" butt…
Browse files Browse the repository at this point in the history
…on (#94730)

* Add external icon to theme demo button

* Add style to icon

* Fix typo
  • Loading branch information
DustyReagan authored Sep 20, 2024
1 parent 965d3a5 commit 2cf1c4b
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 9 deletions.
11 changes: 10 additions & 1 deletion client/my-sites/theme/main.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -600,9 +600,16 @@ class ThemeSheet extends Component {
}

renderScreenshot() {
const { isWpcomTheme, name: themeName, demoUrl, translate } = this.props;
const {
isWpcomTheme,
name: themeName,
demoUrl,
translate,
isExternallyManagedTheme,
} = this.props;
const screenshotFull = isWpcomTheme ? this.getFullLengthScreenshot() : this.props.screenshot;
const width = 735;
const isExternalLink = ! isWpcomTheme || isExternallyManagedTheme;
// Photon may return null, allow fallbacks
const photonSrc = screenshotFull && photon( screenshotFull, { width } );
const img = screenshotFull && (
Expand Down Expand Up @@ -632,6 +639,7 @@ class ThemeSheet extends Component {
{ this.shouldRenderPreviewButton() && (
<Button className="theme__sheet-preview-demo-site">
{ translate( 'Preview demo site' ) }
{ isExternalLink && <Icon icon={ external } size={ 16 } /> }
</Button>
) }
{ img }
Expand All @@ -649,6 +657,7 @@ class ThemeSheet extends Component {
} }
>
{ translate( 'Preview demo site' ) }
{ isExternalLink && <Icon icon={ external } size={ 16 } /> }
</Button>
) }
{ img }
Expand Down
17 changes: 9 additions & 8 deletions client/my-sites/theme/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,15 @@ $button-border: 4px;
order: 1;
}
}

.theme__sheet-demo-button,
.theme__sheet-preview-demo-site {
svg {
vertical-align: text-bottom;
margin-left: 4px;
fill: currentColor;
}
}
}

.theme__sheet-columns.is-removed {
Expand Down Expand Up @@ -246,14 +255,6 @@ $button-border: 4px;
top: auto;
margin-right: 0 !important;
}

.theme__sheet-demo-button {
svg {
vertical-align: text-bottom;
margin-left: 4px;
fill: currentColor;
}
}
}

.theme__sheet-main-info-title {
Expand Down

0 comments on commit 2cf1c4b

Please sign in to comment.