Skip to content

Commit

Permalink
feat(RatingBadge): Star icon support for iOS safari
Browse files Browse the repository at this point in the history
  • Loading branch information
Oscar Martinez authored and ooHmartY committed Jun 29, 2018
1 parent 2c8d46a commit a2a5a59
Show file tree
Hide file tree
Showing 2 changed files with 76 additions and 15 deletions.
7 changes: 6 additions & 1 deletion src/components/Button/RatingBadge.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ const Container = styled.span`
padding-left: 2px;
`;

const StyledStarIcon = styled(StarIcon)`
flex: 0 0 auto;
line-height: 1;
`;

const RatingBadge = ({
variant,
children,
Expand All @@ -25,7 +30,7 @@ const RatingBadge = ({
variant={variant}
{...props}
>
<StarIcon size={12} />
<StyledStarIcon size={12} />
<Container>{children}</Container>
{ratingValue && <meta itemProp="ratingValue" content={ratingValue} />}
{bestRating && <meta itemProp="bestRating" content={bestRating} />}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,17 @@ exports[`RatingBadge /> renders link RatingBadge correctly 1`] = `
cursor: not-allowed;
}
.c1 {
.c2 {
padding-left: 2px;
}
.c1 {
-webkit-flex: 0 0 auto;
-ms-flex: 0 0 auto;
flex: 0 0 auto;
line-height: 1;
}
<button
className="c0"
href="/"
Expand All @@ -54,6 +61,7 @@ exports[`RatingBadge /> renders link RatingBadge correctly 1`] = `
itemType="https://schema.org/AggregateRating"
>
<svg
className="c1"
fill="currentColor"
height={12}
viewBox="0 0 11 10"
Expand All @@ -65,7 +73,7 @@ exports[`RatingBadge /> renders link RatingBadge correctly 1`] = `
/>
</svg>
<span
className="c1"
className="c2"
>
RatingBadge
</span>
Expand Down Expand Up @@ -126,17 +134,25 @@ exports[`RatingBadge /> renders outline RatingBadge correctly 1`] = `
cursor: not-allowed;
}
.c1 {
.c2 {
padding-left: 2px;
}
.c1 {
-webkit-flex: 0 0 auto;
-ms-flex: 0 0 auto;
flex: 0 0 auto;
line-height: 1;
}
<button
className="c0"
itemProp="aggregateRating"
itemScope={true}
itemType="https://schema.org/AggregateRating"
>
<svg
className="c1"
fill="currentColor"
height={12}
viewBox="0 0 11 10"
Expand All @@ -148,7 +164,7 @@ exports[`RatingBadge /> renders outline RatingBadge correctly 1`] = `
/>
</svg>
<span
className="c1"
className="c2"
>
RatingBadge
</span>
Expand Down Expand Up @@ -209,10 +225,17 @@ exports[`RatingBadge /> renders outline disabled RatingBadge correctly 1`] = `
cursor: not-allowed;
}
.c1 {
.c2 {
padding-left: 2px;
}
.c1 {
-webkit-flex: 0 0 auto;
-ms-flex: 0 0 auto;
flex: 0 0 auto;
line-height: 1;
}
<button
className="c0"
disabled={true}
Expand All @@ -221,6 +244,7 @@ exports[`RatingBadge /> renders outline disabled RatingBadge correctly 1`] = `
itemType="https://schema.org/AggregateRating"
>
<svg
className="c1"
fill="currentColor"
height={12}
viewBox="0 0 11 10"
Expand All @@ -232,7 +256,7 @@ exports[`RatingBadge /> renders outline disabled RatingBadge correctly 1`] = `
/>
</svg>
<span
className="c1"
className="c2"
>
RatingBadge
</span>
Expand Down Expand Up @@ -293,17 +317,25 @@ exports[`RatingBadge /> renders standard RatingBadge correctly 1`] = `
cursor: not-allowed;
}
.c1 {
.c2 {
padding-left: 2px;
}
.c1 {
-webkit-flex: 0 0 auto;
-ms-flex: 0 0 auto;
flex: 0 0 auto;
line-height: 1;
}
<button
className="c0"
itemProp="aggregateRating"
itemScope={true}
itemType="https://schema.org/AggregateRating"
>
<svg
className="c1"
fill="currentColor"
height={12}
viewBox="0 0 11 10"
Expand All @@ -315,7 +347,7 @@ exports[`RatingBadge /> renders standard RatingBadge correctly 1`] = `
/>
</svg>
<span
className="c1"
className="c2"
>
RatingBadge
</span>
Expand Down Expand Up @@ -376,10 +408,17 @@ exports[`RatingBadge /> renders standard disabled RatingBadge correctly 1`] = `
cursor: not-allowed;
}
.c1 {
.c2 {
padding-left: 2px;
}
.c1 {
-webkit-flex: 0 0 auto;
-ms-flex: 0 0 auto;
flex: 0 0 auto;
line-height: 1;
}
<button
className="c0"
disabled={true}
Expand All @@ -388,6 +427,7 @@ exports[`RatingBadge /> renders standard disabled RatingBadge correctly 1`] = `
itemType="https://schema.org/AggregateRating"
>
<svg
className="c1"
fill="currentColor"
height={12}
viewBox="0 0 11 10"
Expand All @@ -399,7 +439,7 @@ exports[`RatingBadge /> renders standard disabled RatingBadge correctly 1`] = `
/>
</svg>
<span
className="c1"
className="c2"
>
RatingBadge
</span>
Expand Down Expand Up @@ -460,17 +500,25 @@ exports[`RatingBadge /> renders transparent RatingBadge correctly 1`] = `
cursor: not-allowed;
}
.c1 {
.c2 {
padding-left: 2px;
}
.c1 {
-webkit-flex: 0 0 auto;
-ms-flex: 0 0 auto;
flex: 0 0 auto;
line-height: 1;
}
<button
className="c0"
itemProp="aggregateRating"
itemScope={true}
itemType="https://schema.org/AggregateRating"
>
<svg
className="c1"
fill="currentColor"
height={12}
viewBox="0 0 11 10"
Expand All @@ -482,7 +530,7 @@ exports[`RatingBadge /> renders transparent RatingBadge correctly 1`] = `
/>
</svg>
<span
className="c1"
className="c2"
>
RatingBadge
</span>
Expand Down Expand Up @@ -543,10 +591,17 @@ exports[`RatingBadge /> renders transparent disabled RatingBadge correctly 1`] =
cursor: not-allowed;
}
.c1 {
.c2 {
padding-left: 2px;
}
.c1 {
-webkit-flex: 0 0 auto;
-ms-flex: 0 0 auto;
flex: 0 0 auto;
line-height: 1;
}
<button
className="c0"
disabled={true}
Expand All @@ -555,6 +610,7 @@ exports[`RatingBadge /> renders transparent disabled RatingBadge correctly 1`] =
itemType="https://schema.org/AggregateRating"
>
<svg
className="c1"
fill="currentColor"
height={12}
viewBox="0 0 11 10"
Expand All @@ -566,7 +622,7 @@ exports[`RatingBadge /> renders transparent disabled RatingBadge correctly 1`] =
/>
</svg>
<span
className="c1"
className="c2"
>
RatingBadge
</span>
Expand Down

0 comments on commit a2a5a59

Please sign in to comment.