docusaurus icon indicating copy to clipboard operation
docusaurus copied to clipboard

Custom Admonition Icon: Resize and Center Vertically

Open baur opened this issue 1 year ago • 4 comments

Description

Custom icon for Admonition too small and not centrated by vertical

Cutom:

image

Default:

image

Visual comparing

image

Your environment

  • Docusaurus version used: 3.4
  • Environment name and version (e.g. Chrome 89, Node.js 16.4): Chrome, Node v20
  • Operating system and version (e.g. Ubuntu 20.04.2 LTS): Win10

baur avatar Jul 03 '24 09:07 baur

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

slorber avatar Jul 10 '24 13:07 slorber

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.

malik-na avatar Jul 14 '24 20:07 malik-na

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>

baur avatar Jul 15 '24 03:07 baur

is this issue open?

SamuvelRaja avatar Aug 09 '24 05:08 SamuvelRaja

/assign

Shahab-16 avatar Oct 23 '24 12:10 Shahab-16