question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Since the 3.9s, Icon's customizability has become lower and lower

See original GitHub issue
  • I have searched the issues of this repository and believe that this is not a duplicate.

What problem does this feature solve?

Before 3.9, I can directly modify the default icon style with my custom style without changing the framework code, but I can no longer use it after 3.9, for example:

/* <= 3.8.x */
.my-custom-class .ant-select-selection__rendered > ul {
    padding-right: 10px;
}
.my-custom-class .ant-select-selection__rendered::before {
    display: inline-block;
    -webkit-animation: loadingCircle 1s infinite linear;
    animation: loadingCircle 1s infinite linear;
    content: "\E64D";
    color: #1890ff;
    position: absolute;
    pointer-events: none;
    width: 20px;
    height: 20px;
    text-align: center;
    font-size: 14px;
    font-family: anticon;
    visibility: visible;
    /* and xxx... */
}

The function that this style wants to achieve is to add a loading animation to the right of the Select component without destroying the original framework code, but after 3.9 I want to implement this function, there is no idea at all. You might tell me to use content: url(loading.svg), but the defect is that there is no custom svg color.

Throughout the industry’s usage, such as fontawesome, they provide both font-family and svg forms. Obviously they have more practical experience.

What does the proposed API look like?

The Icon component either provides two ways of using (svg children and pseudo-element content font-family), or gives up using svg. Just like this:

// font-family
<Icon.Font type="loading" />

// svg
<Icon.Svg type="loading" />

For ant-design code, Icon.Font is used by default.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:9 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
Hughencommented, Sep 14, 2018

@HeskeyBaozi Maybe I didn’t express it clearly. I want to talk about such a problem: I can’t modify the style without destroying or modifying the ant-design code with svg. OK, now the Select component looks like I have this feature, and for other components, I can’t guarantee that all components have this advanced customization capability.

0reactions
Hughencommented, Sep 15, 2018

After reading this post #10353 , I have a clearer idea to refute you.

Bg:

Svg is superior to font in imaging and supports multiple colors. We can see that the Icon component has been added to the mixed color mode. That’s very nice. All the components of the ant-design library, as long as they contain the icon display, start to adopt svg, then the problem arises, in order to adapt the developer’s needs for custom icons. Are you still busy developing a batch of interfaces in order to allow them to control svg.

For example, I added a loading style to the Select component which I mentioned earlier. When ant-design does not introduce the suffix interface, I can use the pseudo-element to easily inherit from the existing library to the loading style. But now, what should I do? This is my implementation plan:

  1. Introduce fonts from third parties;
  2.  .my-costom-class svg {
         display: none;
     }
    
  3.  .my-costom-class::before {
         content: "\ABCD";
         font-family: third-party-font;
     }
    

I always feel that this way is more unacceptable than the way I used to.

What is your plan for the next version?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Introducing Astra 3.9: Create the Ultimate Shopping Experience
The Astra 3.9 update delivers a raft of improvements to online stores to help make them more attractive and more profitable!
Read more >
23 Fastest WooCommerce Themes in 2022 (Based on ... - Kinsta
We tested and compared the fastest WooCommerce themes to find the quickest options on the market, with performance and load time tests.
Read more >
ADVX Mako | PlanetSide 2 Wiki - Fandom
The ADVX // Mako, formerly known as the SR-200, is a sniper rifle available to Nanite Systems Operatives. It is unlocked through purchase...
Read more >
10+ of the Best Free Elementor Themes in 2022 (Plus ...
This theme stays true to its name, as it focuses heavily on customization. With Customify, you'll gain access to a header and footer...
Read more >
Integrating discrete events and continuous head movements ...
When gestures are being produced on a ... (2) The user should be able to execute not less than ... as possible because...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found