mirror of
https://github.com/ant-design/ant-design.git
synced 2026-02-09 02:49:18 +08:00
fix(Typography): lower link selector specificity (#56759)
* fix(Typography): lower link selector specificity and add danger debug demo * fix(Typography): scope link styles and raise type color priority * chore: update snap * chore: update snap * fix(Typography): scope link styles and ensure type colors win --------- Co-authored-by: 遇见同学 <1875694521@qq.com>
This commit is contained in:
@@ -93,7 +93,7 @@ exports[`renders components/drawer/demo/_semantic.tsx correctly 1`] = `
|
||||
class="ant-drawer-footer semantic-mark-footer"
|
||||
>
|
||||
<a
|
||||
class="ant-typography css-var-test-id"
|
||||
class="ant-typography ant-typography-link css-var-test-id"
|
||||
>
|
||||
Footer
|
||||
</a>
|
||||
|
||||
@@ -7118,7 +7118,7 @@ exports[`renders components/dropdown/demo/render-panel.tsx extend context correc
|
||||
exports[`renders components/dropdown/demo/selectable.tsx extend context correctly 1`] = `
|
||||
Array [
|
||||
<a
|
||||
class="ant-typography ant-dropdown-trigger css-var-test-id"
|
||||
class="ant-typography ant-typography-link ant-dropdown-trigger css-var-test-id"
|
||||
>
|
||||
<div
|
||||
class="ant-space ant-space-horizontal ant-space-align-center ant-space-gap-row-small ant-space-gap-col-small css-var-test-id"
|
||||
|
||||
@@ -1262,7 +1262,7 @@ exports[`renders components/dropdown/demo/render-panel.tsx correctly 1`] = `
|
||||
|
||||
exports[`renders components/dropdown/demo/selectable.tsx correctly 1`] = `
|
||||
<a
|
||||
class="ant-typography ant-dropdown-trigger css-var-test-id"
|
||||
class="ant-typography ant-typography-link ant-dropdown-trigger css-var-test-id"
|
||||
>
|
||||
<div
|
||||
class="ant-space ant-space-horizontal ant-space-align-center ant-space-gap-row-small ant-space-gap-col-small css-var-test-id"
|
||||
|
||||
@@ -1052,7 +1052,7 @@ exports[`renders components/modal/demo/render-panel.tsx extend context correctly
|
||||
class="ant-typography css-var-test-id"
|
||||
>
|
||||
<a
|
||||
class="ant-typography css-var-test-id"
|
||||
class="ant-typography ant-typography-link css-var-test-id"
|
||||
href="https://github.com/ant-design/ant-design/pull/44318"
|
||||
>
|
||||
Feature #44318
|
||||
|
||||
@@ -1014,7 +1014,7 @@ exports[`renders components/modal/demo/render-panel.tsx correctly 1`] = `
|
||||
class="ant-typography css-var-test-id"
|
||||
>
|
||||
<a
|
||||
class="ant-typography css-var-test-id"
|
||||
class="ant-typography ant-typography-link css-var-test-id"
|
||||
href="https://github.com/ant-design/ant-design/pull/44318"
|
||||
>
|
||||
Feature #44318
|
||||
|
||||
@@ -16413,7 +16413,7 @@ exports[`renders components/space/demo/separator.tsx extend context correctly 1`
|
||||
class="ant-space-item"
|
||||
>
|
||||
<a
|
||||
class="ant-typography css-var-test-id"
|
||||
class="ant-typography ant-typography-link css-var-test-id"
|
||||
>
|
||||
Link
|
||||
</a>
|
||||
@@ -16430,7 +16430,7 @@ exports[`renders components/space/demo/separator.tsx extend context correctly 1`
|
||||
class="ant-space-item"
|
||||
>
|
||||
<a
|
||||
class="ant-typography css-var-test-id"
|
||||
class="ant-typography ant-typography-link css-var-test-id"
|
||||
>
|
||||
Link
|
||||
</a>
|
||||
@@ -16447,7 +16447,7 @@ exports[`renders components/space/demo/separator.tsx extend context correctly 1`
|
||||
class="ant-space-item"
|
||||
>
|
||||
<a
|
||||
class="ant-typography css-var-test-id"
|
||||
class="ant-typography ant-typography-link css-var-test-id"
|
||||
>
|
||||
Link
|
||||
</a>
|
||||
|
||||
@@ -4275,7 +4275,7 @@ exports[`renders components/space/demo/separator.tsx correctly 1`] = `
|
||||
class="ant-space-item"
|
||||
>
|
||||
<a
|
||||
class="ant-typography css-var-test-id"
|
||||
class="ant-typography ant-typography-link css-var-test-id"
|
||||
>
|
||||
Link
|
||||
</a>
|
||||
@@ -4292,7 +4292,7 @@ exports[`renders components/space/demo/separator.tsx correctly 1`] = `
|
||||
class="ant-space-item"
|
||||
>
|
||||
<a
|
||||
class="ant-typography css-var-test-id"
|
||||
class="ant-typography ant-typography-link css-var-test-id"
|
||||
>
|
||||
Link
|
||||
</a>
|
||||
@@ -4309,7 +4309,7 @@ exports[`renders components/space/demo/separator.tsx correctly 1`] = `
|
||||
class="ant-space-item"
|
||||
>
|
||||
<a
|
||||
class="ant-typography css-var-test-id"
|
||||
class="ant-typography ant-typography-link css-var-test-id"
|
||||
>
|
||||
Link
|
||||
</a>
|
||||
|
||||
@@ -8550,7 +8550,7 @@ exports[`renders components/table/demo/edit-row.tsx extend context correctly 1`]
|
||||
class="ant-table-cell"
|
||||
>
|
||||
<a
|
||||
class="ant-typography css-var-test-id"
|
||||
class="ant-typography ant-typography-link css-var-test-id"
|
||||
>
|
||||
Edit
|
||||
</a>
|
||||
@@ -8579,7 +8579,7 @@ exports[`renders components/table/demo/edit-row.tsx extend context correctly 1`]
|
||||
class="ant-table-cell"
|
||||
>
|
||||
<a
|
||||
class="ant-typography css-var-test-id"
|
||||
class="ant-typography ant-typography-link css-var-test-id"
|
||||
>
|
||||
Edit
|
||||
</a>
|
||||
@@ -8608,7 +8608,7 @@ exports[`renders components/table/demo/edit-row.tsx extend context correctly 1`]
|
||||
class="ant-table-cell"
|
||||
>
|
||||
<a
|
||||
class="ant-typography css-var-test-id"
|
||||
class="ant-typography ant-typography-link css-var-test-id"
|
||||
>
|
||||
Edit
|
||||
</a>
|
||||
@@ -8637,7 +8637,7 @@ exports[`renders components/table/demo/edit-row.tsx extend context correctly 1`]
|
||||
class="ant-table-cell"
|
||||
>
|
||||
<a
|
||||
class="ant-typography css-var-test-id"
|
||||
class="ant-typography ant-typography-link css-var-test-id"
|
||||
>
|
||||
Edit
|
||||
</a>
|
||||
@@ -8666,7 +8666,7 @@ exports[`renders components/table/demo/edit-row.tsx extend context correctly 1`]
|
||||
class="ant-table-cell"
|
||||
>
|
||||
<a
|
||||
class="ant-typography css-var-test-id"
|
||||
class="ant-typography ant-typography-link css-var-test-id"
|
||||
>
|
||||
Edit
|
||||
</a>
|
||||
@@ -8695,7 +8695,7 @@ exports[`renders components/table/demo/edit-row.tsx extend context correctly 1`]
|
||||
class="ant-table-cell"
|
||||
>
|
||||
<a
|
||||
class="ant-typography css-var-test-id"
|
||||
class="ant-typography ant-typography-link css-var-test-id"
|
||||
>
|
||||
Edit
|
||||
</a>
|
||||
@@ -8724,7 +8724,7 @@ exports[`renders components/table/demo/edit-row.tsx extend context correctly 1`]
|
||||
class="ant-table-cell"
|
||||
>
|
||||
<a
|
||||
class="ant-typography css-var-test-id"
|
||||
class="ant-typography ant-typography-link css-var-test-id"
|
||||
>
|
||||
Edit
|
||||
</a>
|
||||
@@ -8753,7 +8753,7 @@ exports[`renders components/table/demo/edit-row.tsx extend context correctly 1`]
|
||||
class="ant-table-cell"
|
||||
>
|
||||
<a
|
||||
class="ant-typography css-var-test-id"
|
||||
class="ant-typography ant-typography-link css-var-test-id"
|
||||
>
|
||||
Edit
|
||||
</a>
|
||||
@@ -8782,7 +8782,7 @@ exports[`renders components/table/demo/edit-row.tsx extend context correctly 1`]
|
||||
class="ant-table-cell"
|
||||
>
|
||||
<a
|
||||
class="ant-typography css-var-test-id"
|
||||
class="ant-typography ant-typography-link css-var-test-id"
|
||||
>
|
||||
Edit
|
||||
</a>
|
||||
@@ -8811,7 +8811,7 @@ exports[`renders components/table/demo/edit-row.tsx extend context correctly 1`]
|
||||
class="ant-table-cell"
|
||||
>
|
||||
<a
|
||||
class="ant-typography css-var-test-id"
|
||||
class="ant-typography ant-typography-link css-var-test-id"
|
||||
>
|
||||
Edit
|
||||
</a>
|
||||
|
||||
@@ -7504,7 +7504,7 @@ exports[`renders components/table/demo/edit-row.tsx correctly 1`] = `
|
||||
class="ant-table-cell"
|
||||
>
|
||||
<a
|
||||
class="ant-typography css-var-test-id"
|
||||
class="ant-typography ant-typography-link css-var-test-id"
|
||||
>
|
||||
Edit
|
||||
</a>
|
||||
@@ -7533,7 +7533,7 @@ exports[`renders components/table/demo/edit-row.tsx correctly 1`] = `
|
||||
class="ant-table-cell"
|
||||
>
|
||||
<a
|
||||
class="ant-typography css-var-test-id"
|
||||
class="ant-typography ant-typography-link css-var-test-id"
|
||||
>
|
||||
Edit
|
||||
</a>
|
||||
@@ -7562,7 +7562,7 @@ exports[`renders components/table/demo/edit-row.tsx correctly 1`] = `
|
||||
class="ant-table-cell"
|
||||
>
|
||||
<a
|
||||
class="ant-typography css-var-test-id"
|
||||
class="ant-typography ant-typography-link css-var-test-id"
|
||||
>
|
||||
Edit
|
||||
</a>
|
||||
@@ -7591,7 +7591,7 @@ exports[`renders components/table/demo/edit-row.tsx correctly 1`] = `
|
||||
class="ant-table-cell"
|
||||
>
|
||||
<a
|
||||
class="ant-typography css-var-test-id"
|
||||
class="ant-typography ant-typography-link css-var-test-id"
|
||||
>
|
||||
Edit
|
||||
</a>
|
||||
@@ -7620,7 +7620,7 @@ exports[`renders components/table/demo/edit-row.tsx correctly 1`] = `
|
||||
class="ant-table-cell"
|
||||
>
|
||||
<a
|
||||
class="ant-typography css-var-test-id"
|
||||
class="ant-typography ant-typography-link css-var-test-id"
|
||||
>
|
||||
Edit
|
||||
</a>
|
||||
@@ -7649,7 +7649,7 @@ exports[`renders components/table/demo/edit-row.tsx correctly 1`] = `
|
||||
class="ant-table-cell"
|
||||
>
|
||||
<a
|
||||
class="ant-typography css-var-test-id"
|
||||
class="ant-typography ant-typography-link css-var-test-id"
|
||||
>
|
||||
Edit
|
||||
</a>
|
||||
@@ -7678,7 +7678,7 @@ exports[`renders components/table/demo/edit-row.tsx correctly 1`] = `
|
||||
class="ant-table-cell"
|
||||
>
|
||||
<a
|
||||
class="ant-typography css-var-test-id"
|
||||
class="ant-typography ant-typography-link css-var-test-id"
|
||||
>
|
||||
Edit
|
||||
</a>
|
||||
@@ -7707,7 +7707,7 @@ exports[`renders components/table/demo/edit-row.tsx correctly 1`] = `
|
||||
class="ant-table-cell"
|
||||
>
|
||||
<a
|
||||
class="ant-typography css-var-test-id"
|
||||
class="ant-typography ant-typography-link css-var-test-id"
|
||||
>
|
||||
Edit
|
||||
</a>
|
||||
@@ -7736,7 +7736,7 @@ exports[`renders components/table/demo/edit-row.tsx correctly 1`] = `
|
||||
class="ant-table-cell"
|
||||
>
|
||||
<a
|
||||
class="ant-typography css-var-test-id"
|
||||
class="ant-typography ant-typography-link css-var-test-id"
|
||||
>
|
||||
Edit
|
||||
</a>
|
||||
@@ -7765,7 +7765,7 @@ exports[`renders components/table/demo/edit-row.tsx correctly 1`] = `
|
||||
class="ant-table-cell"
|
||||
>
|
||||
<a
|
||||
class="ant-typography css-var-test-id"
|
||||
class="ant-typography ant-typography-link css-var-test-id"
|
||||
>
|
||||
Edit
|
||||
</a>
|
||||
|
||||
@@ -440,6 +440,7 @@ const Base = React.forwardRef<HTMLElement, BlockProps>((props, ref) => {
|
||||
[`${prefixCls}-ellipsis`]: enableEllipsis,
|
||||
[`${prefixCls}-ellipsis-single-line`]: cssTextOverflow,
|
||||
[`${prefixCls}-ellipsis-multiple-line`]: cssLineClamp,
|
||||
[`${prefixCls}-link`]: component === 'a',
|
||||
},
|
||||
className,
|
||||
)}
|
||||
|
||||
@@ -59,7 +59,7 @@ exports[`renders components/typography/demo/basic.tsx extend context correctly 1
|
||||
<ul>
|
||||
<li>
|
||||
<a
|
||||
class="ant-typography css-var-test-id"
|
||||
class="ant-typography ant-typography-link css-var-test-id"
|
||||
href="/docs/spec/proximity"
|
||||
>
|
||||
Principles
|
||||
@@ -67,7 +67,7 @@ exports[`renders components/typography/demo/basic.tsx extend context correctly 1
|
||||
</li>
|
||||
<li>
|
||||
<a
|
||||
class="ant-typography css-var-test-id"
|
||||
class="ant-typography ant-typography-link css-var-test-id"
|
||||
href="/docs/spec/overview"
|
||||
>
|
||||
Patterns
|
||||
@@ -75,7 +75,7 @@ exports[`renders components/typography/demo/basic.tsx extend context correctly 1
|
||||
</li>
|
||||
<li>
|
||||
<a
|
||||
class="ant-typography css-var-test-id"
|
||||
class="ant-typography ant-typography-link css-var-test-id"
|
||||
href="/docs/resources"
|
||||
>
|
||||
Resource Download
|
||||
@@ -163,7 +163,7 @@ exports[`renders components/typography/demo/basic.tsx extend context correctly 1
|
||||
<ul>
|
||||
<li>
|
||||
<a
|
||||
class="ant-typography css-var-test-id"
|
||||
class="ant-typography ant-typography-link css-var-test-id"
|
||||
href="/docs/spec/proximity-cn"
|
||||
>
|
||||
设计原则
|
||||
@@ -171,7 +171,7 @@ exports[`renders components/typography/demo/basic.tsx extend context correctly 1
|
||||
</li>
|
||||
<li>
|
||||
<a
|
||||
class="ant-typography css-var-test-id"
|
||||
class="ant-typography ant-typography-link css-var-test-id"
|
||||
href="/docs/spec/overview-cn"
|
||||
>
|
||||
设计模式
|
||||
@@ -179,7 +179,7 @@ exports[`renders components/typography/demo/basic.tsx extend context correctly 1
|
||||
</li>
|
||||
<li>
|
||||
<a
|
||||
class="ant-typography css-var-test-id"
|
||||
class="ant-typography ant-typography-link css-var-test-id"
|
||||
href="/docs/resources-cn"
|
||||
>
|
||||
设计资源
|
||||
@@ -272,7 +272,7 @@ Array [
|
||||
<ul>
|
||||
<li>
|
||||
<a
|
||||
class="ant-typography css-var-test-id"
|
||||
class="ant-typography ant-typography-link css-var-test-id"
|
||||
href="/docs/spec/proximity"
|
||||
>
|
||||
Principles
|
||||
@@ -280,7 +280,7 @@ Array [
|
||||
</li>
|
||||
<li>
|
||||
<a
|
||||
class="ant-typography css-var-test-id"
|
||||
class="ant-typography ant-typography-link css-var-test-id"
|
||||
href="/docs/spec/overview"
|
||||
>
|
||||
Patterns
|
||||
@@ -288,7 +288,7 @@ Array [
|
||||
</li>
|
||||
<li>
|
||||
<a
|
||||
class="ant-typography css-var-test-id"
|
||||
class="ant-typography ant-typography-link css-var-test-id"
|
||||
href="/docs/resources"
|
||||
>
|
||||
Resource Download
|
||||
@@ -371,7 +371,7 @@ Array [
|
||||
<ul>
|
||||
<li>
|
||||
<a
|
||||
class="ant-typography css-var-test-id"
|
||||
class="ant-typography ant-typography-link css-var-test-id"
|
||||
href="/docs/spec/proximity-cn"
|
||||
>
|
||||
设计原则
|
||||
@@ -379,7 +379,7 @@ Array [
|
||||
</li>
|
||||
<li>
|
||||
<a
|
||||
class="ant-typography css-var-test-id"
|
||||
class="ant-typography ant-typography-link css-var-test-id"
|
||||
href="/docs/spec/overview-cn"
|
||||
>
|
||||
设计模式
|
||||
@@ -387,7 +387,7 @@ Array [
|
||||
</li>
|
||||
<li>
|
||||
<a
|
||||
class="ant-typography css-var-test-id"
|
||||
class="ant-typography ant-typography-link css-var-test-id"
|
||||
href="/docs/resources-cn"
|
||||
>
|
||||
设计资源
|
||||
@@ -2233,6 +2233,47 @@ exports[`renders components/typography/demo/ellipsis-middle.tsx extend context c
|
||||
|
||||
exports[`renders components/typography/demo/ellipsis-middle.tsx extend context correctly 2`] = `[]`;
|
||||
|
||||
exports[`renders components/typography/demo/link-danger-debug.tsx extend context correctly 1`] = `
|
||||
<article
|
||||
class="ant-typography css-var-test-id"
|
||||
>
|
||||
<span
|
||||
class="ant-typography css-var-test-id"
|
||||
>
|
||||
Typography.Link 的 type="danger" 颜色应为 error 文本色。
|
||||
</span>
|
||||
<br />
|
||||
<a
|
||||
class="ant-typography ant-typography-danger ant-typography-link css-var-test-id"
|
||||
href="https://ant.design"
|
||||
>
|
||||
Danger Link
|
||||
</a>
|
||||
<div
|
||||
class="ant-divider css-var-test-id ant-divider-horizontal ant-divider-rail"
|
||||
role="separator"
|
||||
/>
|
||||
<span
|
||||
class="ant-typography css-var-test-id"
|
||||
>
|
||||
Button 以 a 标签渲染时,不应被 Typography 链接样式影响。
|
||||
</span>
|
||||
<br />
|
||||
<a
|
||||
aria-disabled="false"
|
||||
class="ant-btn css-var-test-id ant-btn-link ant-btn-color-link ant-btn-variant-link"
|
||||
href="https://ant.design"
|
||||
tabindex="0"
|
||||
>
|
||||
<span>
|
||||
Button Link
|
||||
</span>
|
||||
</a>
|
||||
</article>
|
||||
`;
|
||||
|
||||
exports[`renders components/typography/demo/link-danger-debug.tsx extend context correctly 2`] = `[]`;
|
||||
|
||||
exports[`renders components/typography/demo/paragraph-debug.tsx extend context correctly 1`] = `
|
||||
Array [
|
||||
<h1
|
||||
@@ -2635,7 +2676,7 @@ exports[`renders components/typography/demo/text.tsx extend context correctly 1`
|
||||
class="ant-space-item"
|
||||
>
|
||||
<a
|
||||
class="ant-typography css-var-test-id"
|
||||
class="ant-typography ant-typography-link css-var-test-id"
|
||||
href="https://ant.design"
|
||||
rel="noopener noreferrer"
|
||||
target="_blank"
|
||||
|
||||
@@ -60,7 +60,7 @@ exports[`renders components/typography/demo/basic.tsx correctly 1`] = `
|
||||
<ul>
|
||||
<li>
|
||||
<a
|
||||
class="ant-typography css-var-test-id"
|
||||
class="ant-typography ant-typography-link css-var-test-id"
|
||||
href="/docs/spec/proximity"
|
||||
>
|
||||
Principles
|
||||
@@ -68,7 +68,7 @@ exports[`renders components/typography/demo/basic.tsx correctly 1`] = `
|
||||
</li>
|
||||
<li>
|
||||
<a
|
||||
class="ant-typography css-var-test-id"
|
||||
class="ant-typography ant-typography-link css-var-test-id"
|
||||
href="/docs/spec/overview"
|
||||
>
|
||||
Patterns
|
||||
@@ -76,7 +76,7 @@ exports[`renders components/typography/demo/basic.tsx correctly 1`] = `
|
||||
</li>
|
||||
<li>
|
||||
<a
|
||||
class="ant-typography css-var-test-id"
|
||||
class="ant-typography ant-typography-link css-var-test-id"
|
||||
href="/docs/resources"
|
||||
>
|
||||
Resource Download
|
||||
@@ -164,7 +164,7 @@ exports[`renders components/typography/demo/basic.tsx correctly 1`] = `
|
||||
<ul>
|
||||
<li>
|
||||
<a
|
||||
class="ant-typography css-var-test-id"
|
||||
class="ant-typography ant-typography-link css-var-test-id"
|
||||
href="/docs/spec/proximity-cn"
|
||||
>
|
||||
设计原则
|
||||
@@ -172,7 +172,7 @@ exports[`renders components/typography/demo/basic.tsx correctly 1`] = `
|
||||
</li>
|
||||
<li>
|
||||
<a
|
||||
class="ant-typography css-var-test-id"
|
||||
class="ant-typography ant-typography-link css-var-test-id"
|
||||
href="/docs/spec/overview-cn"
|
||||
>
|
||||
设计模式
|
||||
@@ -180,7 +180,7 @@ exports[`renders components/typography/demo/basic.tsx correctly 1`] = `
|
||||
</li>
|
||||
<li>
|
||||
<a
|
||||
class="ant-typography css-var-test-id"
|
||||
class="ant-typography ant-typography-link css-var-test-id"
|
||||
href="/docs/resources-cn"
|
||||
>
|
||||
设计资源
|
||||
@@ -272,7 +272,7 @@ Array [
|
||||
<ul>
|
||||
<li>
|
||||
<a
|
||||
class="ant-typography css-var-test-id"
|
||||
class="ant-typography ant-typography-link css-var-test-id"
|
||||
href="/docs/spec/proximity"
|
||||
>
|
||||
Principles
|
||||
@@ -280,7 +280,7 @@ Array [
|
||||
</li>
|
||||
<li>
|
||||
<a
|
||||
class="ant-typography css-var-test-id"
|
||||
class="ant-typography ant-typography-link css-var-test-id"
|
||||
href="/docs/spec/overview"
|
||||
>
|
||||
Patterns
|
||||
@@ -288,7 +288,7 @@ Array [
|
||||
</li>
|
||||
<li>
|
||||
<a
|
||||
class="ant-typography css-var-test-id"
|
||||
class="ant-typography ant-typography-link css-var-test-id"
|
||||
href="/docs/resources"
|
||||
>
|
||||
Resource Download
|
||||
@@ -371,7 +371,7 @@ Array [
|
||||
<ul>
|
||||
<li>
|
||||
<a
|
||||
class="ant-typography css-var-test-id"
|
||||
class="ant-typography ant-typography-link css-var-test-id"
|
||||
href="/docs/spec/proximity-cn"
|
||||
>
|
||||
设计原则
|
||||
@@ -379,7 +379,7 @@ Array [
|
||||
</li>
|
||||
<li>
|
||||
<a
|
||||
class="ant-typography css-var-test-id"
|
||||
class="ant-typography ant-typography-link css-var-test-id"
|
||||
href="/docs/spec/overview-cn"
|
||||
>
|
||||
设计模式
|
||||
@@ -387,7 +387,7 @@ Array [
|
||||
</li>
|
||||
<li>
|
||||
<a
|
||||
class="ant-typography css-var-test-id"
|
||||
class="ant-typography ant-typography-link css-var-test-id"
|
||||
href="/docs/resources-cn"
|
||||
>
|
||||
设计资源
|
||||
@@ -1586,6 +1586,45 @@ exports[`renders components/typography/demo/ellipsis-middle.tsx correctly 1`] =
|
||||
</span>
|
||||
`;
|
||||
|
||||
exports[`renders components/typography/demo/link-danger-debug.tsx correctly 1`] = `
|
||||
<article
|
||||
class="ant-typography css-var-test-id"
|
||||
>
|
||||
<span
|
||||
class="ant-typography css-var-test-id"
|
||||
>
|
||||
Typography.Link 的 type="danger" 颜色应为 error 文本色。
|
||||
</span>
|
||||
<br />
|
||||
<a
|
||||
class="ant-typography ant-typography-danger ant-typography-link css-var-test-id"
|
||||
href="https://ant.design"
|
||||
>
|
||||
Danger Link
|
||||
</a>
|
||||
<div
|
||||
class="ant-divider css-var-test-id ant-divider-horizontal ant-divider-rail"
|
||||
role="separator"
|
||||
/>
|
||||
<span
|
||||
class="ant-typography css-var-test-id"
|
||||
>
|
||||
Button 以 a 标签渲染时,不应被 Typography 链接样式影响。
|
||||
</span>
|
||||
<br />
|
||||
<a
|
||||
aria-disabled="false"
|
||||
class="ant-btn css-var-test-id ant-btn-link ant-btn-color-link ant-btn-variant-link"
|
||||
href="https://ant.design"
|
||||
tabindex="0"
|
||||
>
|
||||
<span>
|
||||
Button Link
|
||||
</span>
|
||||
</a>
|
||||
</article>
|
||||
`;
|
||||
|
||||
exports[`renders components/typography/demo/paragraph-debug.tsx correctly 1`] = `
|
||||
Array [
|
||||
<h1
|
||||
@@ -1964,7 +2003,7 @@ exports[`renders components/typography/demo/text.tsx correctly 1`] = `
|
||||
class="ant-space-item"
|
||||
>
|
||||
<a
|
||||
class="ant-typography css-var-test-id"
|
||||
class="ant-typography ant-typography-link css-var-test-id"
|
||||
href="https://ant.design"
|
||||
rel="noopener noreferrer"
|
||||
target="_blank"
|
||||
|
||||
@@ -20,6 +20,6 @@ exports[`Typography rtl render component should be rendered correctly in RTL dir
|
||||
|
||||
exports[`Typography rtl render component should be rendered correctly in RTL direction 4`] = `
|
||||
<a
|
||||
class="ant-typography ant-typography-rtl css-var-root"
|
||||
class="ant-typography ant-typography-rtl ant-typography-link css-var-root"
|
||||
/>
|
||||
`;
|
||||
|
||||
7
components/typography/demo/link-danger-debug.md
Normal file
7
components/typography/demo/link-danger-debug.md
Normal file
@@ -0,0 +1,7 @@
|
||||
## zh-CN
|
||||
|
||||
Typography.Link 的 danger 颜色与 Button Link 的样式隔离。
|
||||
|
||||
## en-US
|
||||
|
||||
Typography.Link danger color and isolation from Button link styles.
|
||||
22
components/typography/demo/link-danger-debug.tsx
Normal file
22
components/typography/demo/link-danger-debug.tsx
Normal file
@@ -0,0 +1,22 @@
|
||||
import React from 'react';
|
||||
import { Button, Divider, Typography } from 'antd';
|
||||
|
||||
const { Text, Link } = Typography;
|
||||
|
||||
const App: React.FC = () => (
|
||||
<Typography>
|
||||
<Text>Typography.Link 的 type="danger" 颜色应为 error 文本色。</Text>
|
||||
<br />
|
||||
<Link href="https://ant.design" type="danger">
|
||||
Danger Link
|
||||
</Link>
|
||||
<Divider />
|
||||
<Text>Button 以 a 标签渲染时,不应被 Typography 链接样式影响。</Text>
|
||||
<br />
|
||||
<Button type="link" href="https://ant.design">
|
||||
Button Link
|
||||
</Button>
|
||||
</Typography>
|
||||
);
|
||||
|
||||
export default App;
|
||||
@@ -27,6 +27,7 @@ coverDark: https://mdn.alipayobjects.com/huamei_7uahnr/afts/img/A*LT2jR41Uj2EAAA
|
||||
<code src="./demo/ellipsis-debug.tsx" debug>Ellipsis Debug</code>
|
||||
<code src="./demo/suffix.tsx">suffix</code>
|
||||
<code src="./demo/componentToken-debug.tsx" debug>Component Token</code>
|
||||
<code src="./demo/link-danger-debug.tsx" debug>Link danger Debug</code>
|
||||
|
||||
## API
|
||||
|
||||
|
||||
@@ -28,6 +28,7 @@ coverDark: https://mdn.alipayobjects.com/huamei_7uahnr/afts/img/A*LT2jR41Uj2EAAA
|
||||
<code src="./demo/ellipsis-debug.tsx" debug>省略号 Debug</code>
|
||||
<code src="./demo/suffix.tsx">后缀</code>
|
||||
<code src="./demo/componentToken-debug.tsx" debug>组件 Token</code>
|
||||
<code src="./demo/link-danger-debug.tsx" debug>Link danger Debug</code>
|
||||
|
||||
## API
|
||||
|
||||
|
||||
@@ -34,24 +34,24 @@ const genTypographyStyle: GenerateStyle<TypographyToken> = (token) => {
|
||||
color: token.colorText,
|
||||
wordBreak: 'break-word',
|
||||
lineHeight: token.lineHeight,
|
||||
[`&${componentCls}-secondary`]: {
|
||||
[`&${componentCls}-secondary, &${componentCls}-link${componentCls}-secondary`]: {
|
||||
color: token.colorTextDescription,
|
||||
},
|
||||
|
||||
[`&${componentCls}-success`]: {
|
||||
[`&${componentCls}-success, &${componentCls}-link${componentCls}-success`]: {
|
||||
color: token.colorSuccessText,
|
||||
},
|
||||
|
||||
[`&${componentCls}-warning`]: {
|
||||
[`&${componentCls}-warning, &${componentCls}-link${componentCls}-warning`]: {
|
||||
color: token.colorWarningText,
|
||||
},
|
||||
|
||||
[`&${componentCls}-danger`]: {
|
||||
[`&${componentCls}-danger, &${componentCls}-link${componentCls}-danger`]: {
|
||||
color: token.colorErrorText,
|
||||
'a&:active, a&:focus': {
|
||||
[`&${componentCls}-link:active, &${componentCls}-link:focus`]: {
|
||||
color: token.colorErrorTextActive,
|
||||
},
|
||||
'a&:hover': {
|
||||
[`&${componentCls}-link:hover`]: {
|
||||
color: token.colorErrorTextHover,
|
||||
},
|
||||
},
|
||||
|
||||
@@ -54,14 +54,13 @@ export const getTitleStyles: GenerateStyle<TypographyToken, CSSObject> = (token)
|
||||
};
|
||||
|
||||
export const getLinkStyles: GenerateStyle<TypographyToken, CSSObject> = (token) => {
|
||||
const { componentCls, antCls } = token;
|
||||
const btnCls = `${antCls}-btn`;
|
||||
const { componentCls } = token;
|
||||
const linkCls = `${componentCls}-link`;
|
||||
|
||||
return {
|
||||
// fix issue: https://github.com/ant-design/ant-design/issues/56606
|
||||
// exclude ant-btn to avoid style conflicts with Button component when it renders as <a></a> tag (variant='link' with href)
|
||||
[`a&:not(${btnCls}), a:not(${btnCls})`]: {
|
||||
[`&${linkCls}`]: {
|
||||
...operationUnit(token),
|
||||
userSelect: 'text',
|
||||
|
||||
[`&[disabled], &${componentCls}-disabled`]: {
|
||||
color: token.colorTextDisabled,
|
||||
|
||||
Reference in New Issue
Block a user