Last active
March 31, 2024 13:50
-
-
Save pointofpresence/c63f9bd2569873670f1f7ec90ad6fc62 to your computer and use it in GitHub Desktop.
Чтобы установить цвет иконки, указанный в пропсе color, в SVG-файле lock.svg, к тегу <svg> добавляется атрибут fill="currentColor". Значение currentColor означает, что цвет будет взят из текущего контекста, в данном случае он будет взят из переданного цвета color для компонента LockIcon. Таким образом, в итоге, иконка будет отображена с цветом, …
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import LockIcon from "../assets/lock.svg" | |
// and then render it as: | |
<LockIcon color={theme.colors.text.primary} /> | |
// and then in lock.svg I just add fill="currentColor" in the svg tag. | |
/* | |
Чтобы установить цвет иконки, указанный в пропсе color, в SVG-файле lock.svg, к тегу <svg> добавляется атрибут | |
fill="currentColor". Значение currentColor означает, что цвет будет взят из текущего контекста, в данном случае | |
он будет взят из переданного цвета color для компонента LockIcon. Таким образом, в итоге, иконка будет отображена | |
с цветом, указанным в пропсе color, благодаря использованию атрибута fill="currentColor" в SVG-файле lock.svg. | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment