Перейти к основному содержимому

12 записей с тегом "react"

Посмотреть все теги

# If you are using Apache as your web server, you can insert this into your .htaccess file:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.html$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule . /index.html [L]
</IfModule>

# I am using react: "^16.12.0" and react-router: "^5.1.2" This method is the Catch-all and is probably the easiest way to get you started.

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.