facebook / docusaurus

Easy to maintain open source documentation websites.
https://docusaurus.io
MIT License
56.72k stars 8.54k forks source link

Custom Admonition Icon: Resize and Center Vertically #10263

Open baur opened 4 months ago

baur commented 4 months ago

Description

Custom icon for Admonition too small and not centrated by vertical

Cutom:

image

Default:

image

Visual comparing

image

Your environment

slorber commented 4 months ago

Agee there is something wrong happening here

If the icon is smaller, it should stay aligned

Apparently it's not the case:

CleanShot 2024-07-10 at 15 07 20

Note: we had a previously slightly related PR here: https://github.com/facebook/docusaurus/pull/8150

malik-na commented 4 months ago

I reviewed the code and here are my observations:

  1. Because the icons are SVGs, you can't always center them using CSS on their wrapper element.
  2. SVG's dimensions need to be defined properly, i.e, x-axis, y-axis in viewBox and height and width in viewPort


Screenshot 2024-07-16 at 2 28 01 AM



  1. If the SVG dimesions are fixed, we can even remove the additional margin at the bottom (if required).


Screenshot 2024-07-16 at 2 09 22 AM



I would like to fix this but unfortunately couldn't locate the custom Icons, you mentioned above, in the repository.

baur commented 4 months ago

This was emoji 💡

<Admonition type="tip" icon="💡" title="Did you know...">
  Use plugins to introduce shorter syntax for the most commonly used JSX
  elements in your project.
</Admonition>
SamuvelRaja commented 3 months ago

is this issue open?

Shahab-16 commented 3 weeks ago

/assign