fix(app): update vue snippet syntax
This commit is contained in:
@@ -30,38 +30,29 @@ export function getCodeSnippets({
|
|||||||
const { r, g, b } = TinyColor(color).toRgb();
|
const { r, g, b } = TinyColor(color).toRgb();
|
||||||
|
|
||||||
return {
|
return {
|
||||||
[SnippetType.HTML]: `<i class="ph${
|
[SnippetType.HTML]: `<i class="ph${isDefaultWeight ? "" : `-${weight}`
|
||||||
isDefaultWeight ? "" : `-${weight}`
|
} ph-${name}"></i>`,
|
||||||
} ph-${name}"></i>`,
|
[SnippetType.REACT]: `<${displayName} size={${size}} ${!isDefaultColor ? `color="${color}" ` : ""
|
||||||
[SnippetType.REACT]: `<${displayName} size={${size}} ${
|
}${isDefaultWeight ? "" : `weight="${weight}" `}/>`,
|
||||||
!isDefaultColor ? `color="${color}" ` : ""
|
[SnippetType.VUE]: `<Ph${displayName} :size="${size}" ${!isDefaultColor ? `color="${color}" ` : ""
|
||||||
}${isDefaultWeight ? "" : `weight="${weight}" `}/>`,
|
}${isDefaultWeight ? "" : `weight="${weight}" `}/>`,
|
||||||
[SnippetType.VUE]: `<ph${displayName
|
|
||||||
.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g, "$1-$2")
|
|
||||||
.toLowerCase()} :size="${size}" ${
|
|
||||||
!isDefaultColor ? `color="${color}" ` : ""
|
|
||||||
}${isDefaultWeight ? "" : `weight="${weight}" `}/>`,
|
|
||||||
[SnippetType.FLUTTER]: `Icon(\n PhosphorIcons.${displayName.replace(
|
[SnippetType.FLUTTER]: `Icon(\n PhosphorIcons.${displayName.replace(
|
||||||
/^\w/,
|
/^\w/,
|
||||||
(c) => c.toLowerCase()
|
(c) => c.toLowerCase()
|
||||||
)}${
|
)}${isDefaultWeight ? "" : weight.replace(/^\w/, (c) => c.toUpperCase())
|
||||||
isDefaultWeight ? "" : weight.replace(/^\w/, (c) => c.toUpperCase())
|
},\n size: ${size.toFixed(1)},\n${!isDefaultColor ? ` color: Color(0xff${color.replace("#", "")}),\n` : ""
|
||||||
},\n size: ${size.toFixed(1)},\n${
|
})`,
|
||||||
!isDefaultColor ? ` color: Color(0xff${color.replace("#", "")}),\n` : ""
|
[SnippetType.ELM]: `Phosphor.${camelName}${isDefaultWeight ? "" : " " + pascalWeight
|
||||||
})`,
|
}
|
||||||
[SnippetType.ELM]: `Phosphor.${camelName}${
|
|
||||||
isDefaultWeight ? "" : " " + pascalWeight
|
|
||||||
}
|
|
||||||
|> withSize ${size}
|
|> withSize ${size}
|
||||||
|> withSizeUnit "px"
|
|> withSizeUnit "px"
|
||||||
|> toHtml []`,
|
|> toHtml []`,
|
||||||
[SnippetType.SWIFT]: `Ph.${camelName}.${weight}${
|
[SnippetType.SWIFT]: `Ph.${camelName}.${weight}${!isDefaultColor
|
||||||
!isDefaultColor
|
|
||||||
? `\n .color(red: ${u8ToCGFloatStr(r)}, green: ${u8ToCGFloatStr(
|
? `\n .color(red: ${u8ToCGFloatStr(r)}, green: ${u8ToCGFloatStr(
|
||||||
g
|
g
|
||||||
)}, blue: ${u8ToCGFloatStr(b)})`
|
)}, blue: ${u8ToCGFloatStr(b)})`
|
||||||
: ""
|
: ""
|
||||||
}
|
}
|
||||||
.frame(width: ${size}, height: ${size})
|
.frame(width: ${size}, height: ${size})
|
||||||
`,
|
`,
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user