Skip to content

Commit

Permalink
Merge thinnest, thinner, and thicker props as a single stroke prop fo…
Browse files Browse the repository at this point in the history
…r Placeholder and adjust some values of them to align with visual design.

Address #1650 (comment)
  • Loading branch information
eason9487 committed Aug 30, 2022
1 parent 656aeb9 commit c6908de
Show file tree
Hide file tree
Showing 8 changed files with 33 additions and 38 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import classnames from 'classnames';

const styleName = {
default: false, // The default style is pre-defined doesn't and need to set another class name.
thinnest: 'gla-ads-mockup__placeholder--thinnest',
thinner: 'gla-ads-mockup__placeholder--thinner',
thicker: 'gla-ads-mockup__placeholder--thicker',
Expand All @@ -19,25 +20,19 @@ const styleName = {
* Renders a placeholder to draw a line.
*
* @param {Object} props React props.
* @param {boolean} [props.thinnest] Whether to draw a thinnest placeholder.
* @param {boolean} [props.thinner] Whether to draw a thinner placeholder.
* @param {boolean} [props.thicker] Whether to draw a thicker placeholder.
* @param {string} [props.width] Placeholder width style, 100% by default. It will be px if the unit is omitted.
* @param {'blue'|'gray-100'|'gray-200'|'gray-300'|'gray-400'|'gray-500'} [props.color='gray-100'] Placeholder color.
* @param {'thinnest'|'thinner'|'default'|'thicker'} [props.stroke='default'] Placeholder stroke size.
*/
export default function Placeholder( {
thinnest,
thinner,
thicker,
width,
color = 'gray-100',
stroke = 'default',
} ) {
const className = classnames(
'gla-ads-mockup__placeholder',
styleName[ color ],
thinnest && styleName.thinnest,
thinner && styleName.thinner,
thicker && styleName.thicker
styleName[ stroke ]
);

let style;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ export default function ProductBanner( { product } ) {
<ScaledText smaller adBadge>
{ product.shopName }
</ScaledText>
<Placeholder thinner width="85" />
<Placeholder thinner width="65" />
<Placeholder thinner width="27" color="blue" />
<Placeholder stroke="thinner" width="85" color="gray-300" />
<Placeholder stroke="thinner" width="65" color="gray-300" />
<Placeholder stroke="thinner" width="27" color="blue" />
</div>
<ShopLogo product={ product } />
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ export default function SearchBar( { hideMenu = false } ) {
className="gla-ads-mockup__search-bar-menu"
hidden={ hideMenu }
>
<Placeholder thinnest color="gray-400" />
<Placeholder thinnest color="gray-400" />
<Placeholder thinnest color="gray-400" />
<Placeholder stroke="thinnest" color="gray-400" />
<Placeholder stroke="thinnest" color="gray-400" />
<Placeholder stroke="thinnest" color="gray-400" />
</div>
</div>
);
Expand Down
10 changes: 5 additions & 5 deletions js/src/components/paid-ads/campaign-preview/mockup-display.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ export default function MockupDisplay( { product } ) {
return (
<div className="gla-ads-mockup gla-ads-mockup-display">
<div className="gla-ads-mockup__display-placeholders">
<Placeholder thinner color="gray-300" />
<Placeholder thinner color="gray-300" width="146" />
<Placeholder thinner color="gray-300" width="149" />
<Placeholder thinner color="gray-300" width="135" />
<Placeholder stroke="thinner" color="gray-300" />
<Placeholder stroke="thinner" color="gray-300" width="146" />
<Placeholder stroke="thinner" color="gray-300" width="149" />
<Placeholder stroke="thinner" color="gray-300" width="135" />
</div>
<div className="gla-ads-mockup__display-product">
<div className="gla-ads-mockup__display-product-locator">
Expand All @@ -45,7 +45,7 @@ export default function MockupDisplay( { product } ) {
<GridiconChevronRight size={ 16 } />
</div>
</div>
<Placeholder thinner color="gray-500" />
<Placeholder stroke="thinner" color="gray-500" />
</div>
<div className="gla-ads-mockup__display-placeholders">
<Placeholder />
Expand Down
6 changes: 3 additions & 3 deletions js/src/components/paid-ads/campaign-preview/mockup-gmail.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ import gmailLogoURL from './images/gmail-logo.svg';
function MailItem() {
return (
<div className="gla-ads-mockup__mail-item">
<Placeholder thinner color="gray-200" width="65" />
<Placeholder thinner color="gray-200" />
<Placeholder thinner width="122" />
<Placeholder stroke="thinner" color="gray-200" width="65" />
<Placeholder stroke="thinner" color="gray-200" />
<Placeholder stroke="thinner" width="122" />
</div>
);
}
Expand Down
18 changes: 9 additions & 9 deletions js/src/components/paid-ads/campaign-preview/mockup-search.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,18 +35,18 @@ export default function MockupSearch( { product } ) {
</div>
<SearchBar hideMenu />
<div className="gla-ads-mockup__search-keywords">
<Placeholder width="30" thicker color="gray-500" />
<Placeholder width="42" thicker />
<Placeholder width="32" thicker />
<Placeholder width="45" thicker />
<Placeholder width="30" thinner color="gray-500" />
<Placeholder width="30" stroke="thicker" color="gray-500" />
<Placeholder width="42" stroke="thicker" />
<Placeholder width="32" stroke="thicker" />
<Placeholder width="45" stroke="thicker" />
<Placeholder width="30" stroke="thinner" color="gray-500" />
</div>
<div className="gla-ads-mockup__search-card">
<div className="gla-ads-mockup__search-card-header">
<ScaledText smaller adBadge>
{ product.shopUrl }
</ScaledText>
<Placeholder thinner width="79" color="blue" />
<Placeholder stroke="thinner" width="79" color="blue" />
</div>
<Flex justfy="space-between" align="stretch">
<div className="gla-ads-mockup__search-card-placeholders">
Expand All @@ -62,8 +62,8 @@ export default function MockupSearch( { product } ) {
</div>
<div className="gla-ads-mockup__search-card">
<div className="gla-ads-mockup__search-card-placeholders">
<Placeholder thinner width="79" color="gray-400" />
<Placeholder thinner color="gray-300" />
<Placeholder stroke="thinner" width="79" color="gray-400" />
<Placeholder stroke="thinner" color="gray-300" />
<Placeholder width="122" />
<Placeholder width="108" />
<Placeholder width="100" />
Expand All @@ -72,7 +72,7 @@ export default function MockupSearch( { product } ) {
</div>
<div className="gla-ads-mockup__search-card">
<div className="gla-ads-mockup__search-card-placeholders">
<Placeholder thinner width="79" color="gray-400" />
<Placeholder stroke="thinner" width="79" color="gray-400" />
</div>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ export default function MockupShopping( { product } ) {
return (
<div className="gla-ads-mockup">
<div className="gla-ads-mockup__tab-list">
<Placeholder thicker />
<Placeholder thicker />
<Placeholder stroke="thicker" />
<Placeholder stroke="thicker" />
<div className="gla-ads-mockup__tab-item-with-logo">
<img
height="30"
Expand All @@ -36,9 +36,9 @@ export default function MockupShopping( { product } ) {
'google-listings-and-ads'
) }
/>
<Placeholder thinner color="gray-500" />
<Placeholder stroke="thinner" color="gray-500" />
</div>
<Placeholder thicker />
<Placeholder stroke="thicker" />
</div>
<div className="gla-ads-mockup__shopping-product">
<ProductCover product={ product } />
Expand Down
4 changes: 2 additions & 2 deletions js/src/components/paid-ads/campaign-preview/mockup-youtube.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ export default function MockupYouTube( { product } ) {
<ScaledText larger color="gray-800">
{ product.title }
</ScaledText>
<Placeholder thicker />
<Placeholder thicker width="135" />
<Placeholder />
<Placeholder width="135" />
<ScaledText smaller adBadge>
{ product.shopName }
</ScaledText>
Expand Down

0 comments on commit c6908de

Please sign in to comment.