Skip to content

Commit

Permalink
feat: migrate less to token for Rate (#42135)
Browse files Browse the repository at this point in the history
* feat: rename rate token

* docs: add component-token demo
  • Loading branch information
MuxinFeng authored May 18, 2023
1 parent cb1368f commit 0ea9c88
Show file tree
Hide file tree
Showing 9 changed files with 672 additions and 27 deletions.
299 changes: 299 additions & 0 deletions components/rate/__tests__/__snapshots__/demo-extend.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -1861,6 +1861,305 @@ Array [
]
`;

exports[`renders components/rate/demo/component-token.tsx extend context correctly 1`] = `
<ul
class="ant-rate"
role="radiogroup"
tabindex="0"
>
<li
class="ant-rate-star ant-rate-star-full"
>
<div
aria-checked="true"
aria-posinset="1"
aria-setsize="5"
role="radio"
tabindex="0"
>
<div
class="ant-rate-star-first"
>
<span
aria-label="star"
class="anticon anticon-star"
role="img"
>
<svg
aria-hidden="true"
data-icon="star"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
>
<path
d="M908.1 353.1l-253.9-36.9L540.7 86.1c-3.1-6.3-8.2-11.4-14.5-14.5-15.8-7.8-35-1.3-42.9 14.5L369.8 316.2l-253.9 36.9c-7 1-13.4 4.3-18.3 9.3a32.05 32.05 0 00.6 45.3l183.7 179.1-43.4 252.9a31.95 31.95 0 0046.4 33.7L512 754l227.1 119.4c6.2 3.3 13.4 4.4 20.3 3.2 17.4-3 29.1-19.5 26.1-36.9l-43.4-252.9 183.7-179.1c5-4.9 8.3-11.3 9.3-18.3 2.7-17.5-9.5-33.7-27-36.3z"
/>
</svg>
</span>
</div>
<div
class="ant-rate-star-second"
>
<span
aria-label="star"
class="anticon anticon-star"
role="img"
>
<svg
aria-hidden="true"
data-icon="star"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
>
<path
d="M908.1 353.1l-253.9-36.9L540.7 86.1c-3.1-6.3-8.2-11.4-14.5-14.5-15.8-7.8-35-1.3-42.9 14.5L369.8 316.2l-253.9 36.9c-7 1-13.4 4.3-18.3 9.3a32.05 32.05 0 00.6 45.3l183.7 179.1-43.4 252.9a31.95 31.95 0 0046.4 33.7L512 754l227.1 119.4c6.2 3.3 13.4 4.4 20.3 3.2 17.4-3 29.1-19.5 26.1-36.9l-43.4-252.9 183.7-179.1c5-4.9 8.3-11.3 9.3-18.3 2.7-17.5-9.5-33.7-27-36.3z"
/>
</svg>
</span>
</div>
</div>
</li>
<li
class="ant-rate-star ant-rate-star-full"
>
<div
aria-checked="true"
aria-posinset="2"
aria-setsize="5"
role="radio"
tabindex="0"
>
<div
class="ant-rate-star-first"
>
<span
aria-label="star"
class="anticon anticon-star"
role="img"
>
<svg
aria-hidden="true"
data-icon="star"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
>
<path
d="M908.1 353.1l-253.9-36.9L540.7 86.1c-3.1-6.3-8.2-11.4-14.5-14.5-15.8-7.8-35-1.3-42.9 14.5L369.8 316.2l-253.9 36.9c-7 1-13.4 4.3-18.3 9.3a32.05 32.05 0 00.6 45.3l183.7 179.1-43.4 252.9a31.95 31.95 0 0046.4 33.7L512 754l227.1 119.4c6.2 3.3 13.4 4.4 20.3 3.2 17.4-3 29.1-19.5 26.1-36.9l-43.4-252.9 183.7-179.1c5-4.9 8.3-11.3 9.3-18.3 2.7-17.5-9.5-33.7-27-36.3z"
/>
</svg>
</span>
</div>
<div
class="ant-rate-star-second"
>
<span
aria-label="star"
class="anticon anticon-star"
role="img"
>
<svg
aria-hidden="true"
data-icon="star"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
>
<path
d="M908.1 353.1l-253.9-36.9L540.7 86.1c-3.1-6.3-8.2-11.4-14.5-14.5-15.8-7.8-35-1.3-42.9 14.5L369.8 316.2l-253.9 36.9c-7 1-13.4 4.3-18.3 9.3a32.05 32.05 0 00.6 45.3l183.7 179.1-43.4 252.9a31.95 31.95 0 0046.4 33.7L512 754l227.1 119.4c6.2 3.3 13.4 4.4 20.3 3.2 17.4-3 29.1-19.5 26.1-36.9l-43.4-252.9 183.7-179.1c5-4.9 8.3-11.3 9.3-18.3 2.7-17.5-9.5-33.7-27-36.3z"
/>
</svg>
</span>
</div>
</div>
</li>
<li
class="ant-rate-star ant-rate-star-zero"
>
<div
aria-checked="true"
aria-posinset="3"
aria-setsize="5"
role="radio"
tabindex="0"
>
<div
class="ant-rate-star-first"
>
<span
aria-label="star"
class="anticon anticon-star"
role="img"
>
<svg
aria-hidden="true"
data-icon="star"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
>
<path
d="M908.1 353.1l-253.9-36.9L540.7 86.1c-3.1-6.3-8.2-11.4-14.5-14.5-15.8-7.8-35-1.3-42.9 14.5L369.8 316.2l-253.9 36.9c-7 1-13.4 4.3-18.3 9.3a32.05 32.05 0 00.6 45.3l183.7 179.1-43.4 252.9a31.95 31.95 0 0046.4 33.7L512 754l227.1 119.4c6.2 3.3 13.4 4.4 20.3 3.2 17.4-3 29.1-19.5 26.1-36.9l-43.4-252.9 183.7-179.1c5-4.9 8.3-11.3 9.3-18.3 2.7-17.5-9.5-33.7-27-36.3z"
/>
</svg>
</span>
</div>
<div
class="ant-rate-star-second"
>
<span
aria-label="star"
class="anticon anticon-star"
role="img"
>
<svg
aria-hidden="true"
data-icon="star"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
>
<path
d="M908.1 353.1l-253.9-36.9L540.7 86.1c-3.1-6.3-8.2-11.4-14.5-14.5-15.8-7.8-35-1.3-42.9 14.5L369.8 316.2l-253.9 36.9c-7 1-13.4 4.3-18.3 9.3a32.05 32.05 0 00.6 45.3l183.7 179.1-43.4 252.9a31.95 31.95 0 0046.4 33.7L512 754l227.1 119.4c6.2 3.3 13.4 4.4 20.3 3.2 17.4-3 29.1-19.5 26.1-36.9l-43.4-252.9 183.7-179.1c5-4.9 8.3-11.3 9.3-18.3 2.7-17.5-9.5-33.7-27-36.3z"
/>
</svg>
</span>
</div>
</div>
</li>
<li
class="ant-rate-star ant-rate-star-zero"
>
<div
aria-checked="false"
aria-posinset="4"
aria-setsize="5"
role="radio"
tabindex="0"
>
<div
class="ant-rate-star-first"
>
<span
aria-label="star"
class="anticon anticon-star"
role="img"
>
<svg
aria-hidden="true"
data-icon="star"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
>
<path
d="M908.1 353.1l-253.9-36.9L540.7 86.1c-3.1-6.3-8.2-11.4-14.5-14.5-15.8-7.8-35-1.3-42.9 14.5L369.8 316.2l-253.9 36.9c-7 1-13.4 4.3-18.3 9.3a32.05 32.05 0 00.6 45.3l183.7 179.1-43.4 252.9a31.95 31.95 0 0046.4 33.7L512 754l227.1 119.4c6.2 3.3 13.4 4.4 20.3 3.2 17.4-3 29.1-19.5 26.1-36.9l-43.4-252.9 183.7-179.1c5-4.9 8.3-11.3 9.3-18.3 2.7-17.5-9.5-33.7-27-36.3z"
/>
</svg>
</span>
</div>
<div
class="ant-rate-star-second"
>
<span
aria-label="star"
class="anticon anticon-star"
role="img"
>
<svg
aria-hidden="true"
data-icon="star"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
>
<path
d="M908.1 353.1l-253.9-36.9L540.7 86.1c-3.1-6.3-8.2-11.4-14.5-14.5-15.8-7.8-35-1.3-42.9 14.5L369.8 316.2l-253.9 36.9c-7 1-13.4 4.3-18.3 9.3a32.05 32.05 0 00.6 45.3l183.7 179.1-43.4 252.9a31.95 31.95 0 0046.4 33.7L512 754l227.1 119.4c6.2 3.3 13.4 4.4 20.3 3.2 17.4-3 29.1-19.5 26.1-36.9l-43.4-252.9 183.7-179.1c5-4.9 8.3-11.3 9.3-18.3 2.7-17.5-9.5-33.7-27-36.3z"
/>
</svg>
</span>
</div>
</div>
</li>
<li
class="ant-rate-star ant-rate-star-zero"
>
<div
aria-checked="false"
aria-posinset="5"
aria-setsize="5"
role="radio"
tabindex="0"
>
<div
class="ant-rate-star-first"
>
<span
aria-label="star"
class="anticon anticon-star"
role="img"
>
<svg
aria-hidden="true"
data-icon="star"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
>
<path
d="M908.1 353.1l-253.9-36.9L540.7 86.1c-3.1-6.3-8.2-11.4-14.5-14.5-15.8-7.8-35-1.3-42.9 14.5L369.8 316.2l-253.9 36.9c-7 1-13.4 4.3-18.3 9.3a32.05 32.05 0 00.6 45.3l183.7 179.1-43.4 252.9a31.95 31.95 0 0046.4 33.7L512 754l227.1 119.4c6.2 3.3 13.4 4.4 20.3 3.2 17.4-3 29.1-19.5 26.1-36.9l-43.4-252.9 183.7-179.1c5-4.9 8.3-11.3 9.3-18.3 2.7-17.5-9.5-33.7-27-36.3z"
/>
</svg>
</span>
</div>
<div
class="ant-rate-star-second"
>
<span
aria-label="star"
class="anticon anticon-star"
role="img"
>
<svg
aria-hidden="true"
data-icon="star"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
>
<path
d="M908.1 353.1l-253.9-36.9L540.7 86.1c-3.1-6.3-8.2-11.4-14.5-14.5-15.8-7.8-35-1.3-42.9 14.5L369.8 316.2l-253.9 36.9c-7 1-13.4 4.3-18.3 9.3a32.05 32.05 0 00.6 45.3l183.7 179.1-43.4 252.9a31.95 31.95 0 0046.4 33.7L512 754l227.1 119.4c6.2 3.3 13.4 4.4 20.3 3.2 17.4-3 29.1-19.5 26.1-36.9l-43.4-252.9 183.7-179.1c5-4.9 8.3-11.3 9.3-18.3 2.7-17.5-9.5-33.7-27-36.3z"
/>
</svg>
</span>
</div>
</div>
</li>
</ul>
`;

exports[`renders components/rate/demo/disabled.tsx extend context correctly 1`] = `
<ul
class="ant-rate ant-rate-disabled"
Expand Down
Loading

0 comments on commit 0ea9c88

Please sign in to comment.