Skip to content

Commit

Permalink
Fixes #1429 - Add sticker image support in clay cards
Browse files Browse the repository at this point in the history
  • Loading branch information
Carlos Lancha committed Jan 9, 2019
1 parent 4e9d312 commit 3d063c3
Show file tree
Hide file tree
Showing 7 changed files with 80 additions and 2 deletions.
18 changes: 18 additions & 0 deletions packages/clay-card/src/ClayCardBase.js
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,24 @@ ClayCardBase.STATE = {
*/
spritemap: Config.string(),

/**
* Alternate text of the image to be renderer inside the sticker.
* @default undefined
* @instance
* @memberof ClayCardBase
* @type {?(string|undefined)}
*/
stickerImageAlt: Config.string(),

/**
* Source of the image to be rendered inside the sticker.
* @default undefined
* @instance
* @memberof ClayCardBase
* @type {?(string|undefined)}
*/
stickerImageSrc: Config.string(),

/**
* Label for the sticker represented in the card.
* @instance
Expand Down
6 changes: 6 additions & 0 deletions packages/clay-card/src/ClayCardBase.soy
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
{@param? selectable: bool}
{@param? selected: bool}
{@param? spritemap: string}
{@param? stickerImageAlt: string}
{@param? stickerImageSrc: string}
{@param? stickerLabel: string}
{@param? stickerShape: string}
{@param? stickerStyle: string}
Expand Down Expand Up @@ -71,6 +73,8 @@
{param imageAlt: $imageAlt /}
{param imageSrc: $imageSrc /}
{param spritemap: $spritemap /}
{param stickerImageAlt: $stickerImageAlt /}
{param stickerImageSrc: $stickerImageSrc /}
{param stickerLabel: $stickerLabel /}
{param stickerShape: $stickerShape /}
{param stickerStyle: $stickerStyle /}
Expand Down Expand Up @@ -187,6 +191,8 @@
{@param? imageAlt: string}
{@param? imageSrc: string}
{@param? spritemap: string}
{@param? stickerImageAlt: string}
{@param? stickerImageSrc: string}
{@param? stickerLabel: string}
{@param? stickerShape: string}
{@param? stickerStyle: string}
Expand Down
18 changes: 18 additions & 0 deletions packages/clay-card/src/ClayFileCard.js
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,24 @@ ClayFileCard.STATE = {
*/
spritemap: Config.string().required(),

/**
* Alternate text of the image to be renderer inside the sticker.
* @default undefined
* @instance
* @memberof ClayFileCard
* @type {?(string|undefined)}
*/
stickerImageAlt: Config.string(),

/**
* Source of the image to be rendered inside the sticker.
* @default undefined
* @instance
* @memberof ClayFileCard
* @type {?(string|undefined)}
*/
stickerImageSrc: Config.string(),

/**
* Label for the sticker represented in the card.
* @default undefined
Expand Down
10 changes: 9 additions & 1 deletion packages/clay-card/src/ClayFileCard.soy
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
{@param? labelStylesMap: ?}
{@param? selectable: bool}
{@param? selected: bool}
{@param? stickerImageAlt: string}
{@param? stickerImageSrc: string}
{@param? stickerLabel: string}
{@param? stickerShape: string}
{@param? stickerStyle: string}
Expand Down Expand Up @@ -56,6 +58,8 @@
{param selectable: $selectable /}
{param selected: $selected /}
{param spritemap: $spritemap /}
{param stickerImageAlt: $stickerImageAlt /}
{param stickerImageSrc: $stickerImageSrc /}
{param stickerLabel: $stickerLabel /}
{param stickerShape: $stickerShape /}
{param stickerStyle: $stickerStyle /}
Expand All @@ -72,6 +76,8 @@
{@param? imageAlt: string}
{@param? imageSrc: string}
{@param? spritemap: string}
{@param? stickerImageAlt: string}
{@param? stickerImageSrc: string}
{@param? stickerLabel: string}
{@param? stickerShape: string}
{@param? stickerStyle: string}
Expand All @@ -85,8 +91,10 @@
</div>
{/if}

{if $stickerLabel}
{if $stickerLabel or $stickerImageSrc}
{call ClaySticker.render}
{param imageAlt: $stickerImageAlt /}
{param imageSrc: $stickerImageSrc /}
{param label: $stickerLabel /}
{param position: 'bottom-left' /}
{param shape: $stickerShape ?: 'rounded' /}
Expand Down
18 changes: 18 additions & 0 deletions packages/clay-card/src/ClayImageCard.js
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,24 @@ ClayImageCard.STATE = {
*/
spritemap: Config.string(),

/**
* Alternate text of the image to be renderer inside the sticker.
* @default undefined
* @instance
* @memberof ClayImageCard
* @type {?(string|undefined)}
*/
stickerImageAlt: Config.string(),

/**
* Source of the image to be rendered inside the sticker.
* @default undefined
* @instance
* @memberof ClayImageCard
* @type {?(string|undefined)}
*/
stickerImageSrc: Config.string(),

/**
* Label for the sticker represented in the card.
* @default undefined
Expand Down
10 changes: 9 additions & 1 deletion packages/clay-card/src/ClayImageCard.soy
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
{@param? selectable: bool}
{@param? selected: bool}
{@param? spritemap: string}
{@param? stickerImageAlt: string}
{@param? stickerImageSrc: string}
{@param? stickerLabel: string}
{@param? stickerShape: string}
{@param? stickerStyle: string}
Expand Down Expand Up @@ -60,6 +62,8 @@
{param selectable: $selectable /}
{param selected: $selected /}
{param spritemap: $spritemap /}
{param stickerImageAlt: $stickerImageAlt /}
{param stickerImageSrc: $stickerImageSrc /}
{param stickerLabel: $stickerLabel /}
{param stickerShape: $stickerShape /}
{param stickerStyle: $stickerStyle /}
Expand All @@ -76,6 +80,8 @@
{@param? imageAlt: string}
{@param? imageSrc: string}
{@param? spritemap: string}
{@param? stickerImageAlt: string}
{@param? stickerImageSrc: string}
{@param? stickerLabel: string}
{@param? stickerShape: string}
{@param? stickerStyle: string}
Expand Down Expand Up @@ -109,8 +115,10 @@
</div>
{/if}

{if $stickerLabel}
{if $stickerLabel or $stickerImageSrc}
{call ClaySticker.render}
{param imageAlt: $stickerImageAlt /}
{param imageSrc: $stickerImageSrc /}
{param label: $stickerLabel /}
{param position: 'bottom-left' /}
{param shape: $stickerShape ?: 'rounded' /}
Expand Down
2 changes: 2 additions & 0 deletions packages/clay-card/src/ClayUserCard.soy
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,8 @@
{@param? imageAlt: string}
{@param? imageSrc: string}
{@param? spritemap: string}
{@param? stickerImageAlt: string}
{@param? stickerImageSrc: string}
{@param? stickerLabel: string}
{@param? stickerShape: string}
{@param? stickerStyle: string}
Expand Down

0 comments on commit 3d063c3

Please sign in to comment.