mirror of
https://github.com/complexcaresolutions/frontend.porwoll.de.git
synced 2026-03-17 21:03:42 +00:00
fix: strip quotes from icon names in DynamicIcon
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
9fe9876de2
commit
6c69491c96
1 changed files with 5 additions and 2 deletions
|
|
@ -12,8 +12,11 @@ interface DynamicIconProps {
|
||||||
* Names can be kebab-case ("shield-check") or PascalCase ("ShieldCheck").
|
* Names can be kebab-case ("shield-check") or PascalCase ("ShieldCheck").
|
||||||
*/
|
*/
|
||||||
export function DynamicIcon({ name, size = 24, className, strokeWidth = 2 }: DynamicIconProps) {
|
export function DynamicIcon({ name, size = 24, className, strokeWidth = 2 }: DynamicIconProps) {
|
||||||
// Convert kebab-case to PascalCase: "shield-check" → "ShieldCheck"
|
// Strip surrounding quotes if present (e.g. "shield" -> shield)
|
||||||
const pascalName = name
|
const cleanName = name.replace(/^["']|["']$/g, '').trim()
|
||||||
|
|
||||||
|
// Convert kebab-case to PascalCase: "shield-check" -> "ShieldCheck"
|
||||||
|
const pascalName = cleanName
|
||||||
.split('-')
|
.split('-')
|
||||||
.map((part) => part.charAt(0).toUpperCase() + part.slice(1))
|
.map((part) => part.charAt(0).toUpperCase() + part.slice(1))
|
||||||
.join('')
|
.join('')
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue