mirror of
https://github.com/CommunityOx/ox_lib.git
synced 2026-08-17 06:56:03 +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: [
|
||||
{ icon: 'palette', label: 'Paint' },
|
||||
{ icon: 'warehouse', label: 'Garage' },
|
||||
{ icon: 'palette', label: 'Quite long text' },
|
||||
{ icon: 'palette', label: 'Quite long \ntext' },
|
||||
{ icon: 'palette', label: 'Paint' },
|
||||
{ icon: 'warehouse', label: 'Garage' },
|
||||
],
|
||||
|
||||
@@ -155,8 +155,11 @@ const RadialMenu: React.FC = () => {
|
||||
height={25}
|
||||
fixedWidth
|
||||
/>
|
||||
<text x={iconX} y={iconY + 25} fill="#fff" textAnchor="middle" pointerEvents="none">
|
||||
{item.label}
|
||||
<text x={iconX} y={iconY + (item.label.includes(" \n") ? 7 : 25)} fill="#fff" textAnchor="middle" pointerEvents="none">
|
||||
{item.label.includes(" \n")
|
||||
? item.label.split(" \n").map((value) => <tspan x={iconX} dy="1.2em">{value}</tspan>)
|
||||
: item.label
|
||||
}
|
||||
</text>
|
||||
</g>
|
||||
</g>
|
||||
|
||||
Reference in New Issue
Block a user