allow include of external svgs without breaking theming

This commit is contained in:
Anton Tranelis 2025-03-19 11:34:22 +00:00
parent 0595e54a9b
commit 0c640e78ef
6 changed files with 29 additions and 3 deletions

20
package-lock.json generated
View File

@ -18,6 +18,7 @@
"radash": "^12.1.0",
"react-colorful": "^5.6.1",
"react-image-crop": "^10.1.8",
"react-inlinesvg": "^4.2.0",
"react-leaflet": "^4.2.1",
"react-leaflet-cluster": "^2.1.0",
"react-markdown": "^9.0.1",
@ -10203,6 +10204,14 @@
"react": "^18.3.1"
}
},
"node_modules/react-from-dom": {
"version": "0.7.5",
"resolved": "https://registry.npmjs.org/react-from-dom/-/react-from-dom-0.7.5.tgz",
"integrity": "sha512-CO92PmMKo/23uYPm6OFvh5CtZbMgHs/Xn+o095Lz/TZj9t8DSDhGdSOMLxBxwWI4sr0MF17KUn9yJWc5Q00R/w==",
"peerDependencies": {
"react": "16.8 - 19"
}
},
"node_modules/react-image-crop": {
"version": "10.1.8",
"resolved": "https://registry.npmjs.org/react-image-crop/-/react-image-crop-10.1.8.tgz",
@ -10212,6 +10221,17 @@
"react": ">=16.13.1"
}
},
"node_modules/react-inlinesvg": {
"version": "4.2.0",
"resolved": "https://registry.npmjs.org/react-inlinesvg/-/react-inlinesvg-4.2.0.tgz",
"integrity": "sha512-V59P6sFU7NACIbvoay9ikYKVFWyIIZFGd7w6YT1m+H7Ues0fOI6B6IftE6NPSYXXv7RHVmrncIyJeYurs3OJcA==",
"dependencies": {
"react-from-dom": "^0.7.5"
},
"peerDependencies": {
"react": "16.8 - 19"
}
},
"node_modules/react-is": {
"version": "17.0.2",
"resolved": "https://registry.npmjs.org/react-is/-/react-is-17.0.2.tgz",

View File

@ -99,6 +99,7 @@
"radash": "^12.1.0",
"react-colorful": "^5.6.1",
"react-image-crop": "^10.1.8",
"react-inlinesvg": "^4.2.0",
"react-leaflet": "^4.2.1",
"react-leaflet-cluster": "^2.1.0",
"react-markdown": "^9.0.1",

View File

@ -1,3 +1,4 @@
export * from './AppShell'
export { SideBar } from './SideBar'
export { Content } from './Content'
export { default as SVG } from 'react-inlinesvg'

View File

@ -1,5 +1,7 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
/* eslint-disable @typescript-eslint/no-non-null-assertion */
import SVG from 'react-inlinesvg'
import PlusSVG from '#assets/plus.svg'
import { useLayers } from '#components/Map/hooks/useLayers'
import { useHasUserPermission } from '#components/Map/hooks/usePermissions'
@ -31,7 +33,7 @@ export default function AddButton({
{canAddItems() ? (
<div className='tw-dropdown tw-dropdown-top tw-dropdown-end tw-dropdown-hover tw-z-500 tw-absolute tw-right-4 tw-bottom-4'>
<label tabIndex={0} className='tw-z-500 tw-btn tw-btn-circle tw-shadow tw-bg-base-100'>
<img src={PlusSVG} alt='Layers' className='tw-h-5 tw-w-5' />
<SVG src={PlusSVG} className='tw-h-5 tw-w-5' />
</label>
<ul tabIndex={0} className='tw-dropdown-content tw-pr-1 tw-list-none'>
{layers.map(

View File

@ -1,4 +1,5 @@
import { useState } from 'react'
import SVG from 'react-inlinesvg'
import LayerSVG from '#assets/layer.svg'
import { useIsLayerVisible, useToggleVisibleLayer } from '#components/Map/hooks/useFilter'
@ -56,7 +57,7 @@ export function LayerControl() {
setOpen(true)
}}
>
<img src={LayerSVG} alt='Layers' />
<SVG src={LayerSVG} />
</div>
)}
</div>

View File

@ -13,6 +13,7 @@ import EllipsisVerticalIcon from '@heroicons/react/16/solid/EllipsisVerticalIcon
import PencilIcon from '@heroicons/react/24/solid/PencilIcon'
import TrashIcon from '@heroicons/react/24/solid/TrashIcon'
import { useState } from 'react'
import SVG from 'react-inlinesvg'
import { useNavigate } from 'react-router-dom'
import TargetDotSVG from '#assets/targetDot.svg'
@ -159,7 +160,7 @@ export function HeaderView({
className='!tw-text-base-content tw-cursor-pointer'
onClick={setPositionCallback}
>
<img src={TargetDotSVG} alt='Position' className='tw-w-5 tw-h-5' />
<SVG src={TargetDotSVG} className='tw-w-5 tw-h-5' />
</a>
</li>
)}