diff --git a/components/timeline/TimelineItem.tsx b/components/timeline/TimelineItem.tsx index 78ac488b4b..de1e169cd1 100644 --- a/components/timeline/TimelineItem.tsx +++ b/components/timeline/TimelineItem.tsx @@ -47,14 +47,13 @@ const TimelineItem: React.FC = ({ [`${prefixCls}-item-head-${color}`]: true, }); + const customColor = /blue|red|green|gray/.test(color || '') ? undefined : color; + return (
  • {label &&
    {label}
    }
    -
    +
    {dot}
    {children}
    diff --git a/components/timeline/__tests__/__snapshots__/demo-extend.test.ts.snap b/components/timeline/__tests__/__snapshots__/demo-extend.test.ts.snap index 36921c182d..0932dfbb2c 100644 --- a/components/timeline/__tests__/__snapshots__/demo-extend.test.ts.snap +++ b/components/timeline/__tests__/__snapshots__/demo-extend.test.ts.snap @@ -316,7 +316,7 @@ exports[`renders ./components/timeline/demo/color.md extend context correctly 1`
  • +
  • +
    +
    + + + +
    +
    +

    + Custom color testing +

    +
    +
  • `; diff --git a/components/timeline/__tests__/__snapshots__/demo.test.js.snap b/components/timeline/__tests__/__snapshots__/demo.test.js.snap index d6d89848c1..3f16cbf7e2 100644 --- a/components/timeline/__tests__/__snapshots__/demo.test.js.snap +++ b/components/timeline/__tests__/__snapshots__/demo.test.js.snap @@ -316,7 +316,7 @@ exports[`renders ./components/timeline/demo/color.md correctly 1`] = `
  • +
  • +
    +
    + + + +
    +
    +

    + Custom color testing +

    +
    +
  • `; diff --git a/components/timeline/demo/color.md b/components/timeline/demo/color.md index adfd03b480..8796b1a72f 100644 --- a/components/timeline/demo/color.md +++ b/components/timeline/demo/color.md @@ -15,6 +15,7 @@ Set the color of circles. `green` means completed or success status, `red` means ```jsx import { Timeline } from 'antd'; +import { SmileOutlined } from '@ant-design/icons'; ReactDOM.render( @@ -40,6 +41,9 @@ ReactDOM.render(

    Technical testing 2

    Technical testing 3 2015-09-01

    + }> +

    Custom color testing

    +
    , mountNode, );