mirror of
https://github.com/CommunityOx/ox_lib.git
synced 2026-08-18 15:36:02 +01:00
feat(web/radial): newlines support (#316)
* feat(radial): Support newlines * chore: update to ` \n` to match markdown
This commit is contained in:
@@ -9,7 +9,7 @@ export const debugRadial = () => {
|
|||||||
items: [
|
items: [
|
||||||
{ icon: 'palette', label: 'Paint' },
|
{ icon: 'palette', label: 'Paint' },
|
||||||
{ icon: 'warehouse', label: 'Garage' },
|
{ icon: 'warehouse', label: 'Garage' },
|
||||||
{ icon: 'palette', label: 'Quite long text' },
|
{ icon: 'palette', label: 'Quite long \ntext' },
|
||||||
{ icon: 'palette', label: 'Paint' },
|
{ icon: 'palette', label: 'Paint' },
|
||||||
{ icon: 'warehouse', label: 'Garage' },
|
{ icon: 'warehouse', label: 'Garage' },
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -155,8 +155,11 @@ const RadialMenu: React.FC = () => {
|
|||||||
height={25}
|
height={25}
|
||||||
fixedWidth
|
fixedWidth
|
||||||
/>
|
/>
|
||||||
<text x={iconX} y={iconY + 25} fill="#fff" textAnchor="middle" pointerEvents="none">
|
<text x={iconX} y={iconY + (item.label.includes(" \n") ? 7 : 25)} fill="#fff" textAnchor="middle" pointerEvents="none">
|
||||||
{item.label}
|
{item.label.includes(" \n")
|
||||||
|
? item.label.split(" \n").map((value) => <tspan x={iconX} dy="1.2em">{value}</tspan>)
|
||||||
|
: item.label
|
||||||
|
}
|
||||||
</text>
|
</text>
|
||||||
</g>
|
</g>
|
||||||
</g>
|
</g>
|
||||||
|
|||||||
Reference in New Issue
Block a user