Skip to content

Commit e80ebd7

Browse files
committed
replace hard svg path string to mudblazor icons
1 parent 7307650 commit e80ebd7

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

src/Components/MudStaticRadio.razor

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,7 @@
2424
aria-hidden="true"
2525
role="img"
2626
id="@($"radio-svg-{_elementId}")">
27-
<path d="M0 0h24v24H0z" fill="none"></path>
28-
<path d="@(IsChecked ? Checked : UnChecked)"></path>
27+
@(new MarkupString(IsChecked ? Icons.Material.Filled.RadioButtonChecked : Icons.Material.Filled.RadioButtonUnchecked))
2928
</svg>
3029
</span>
3130

@@ -41,13 +40,12 @@
4140
const radio = document.getElementById('static-radio-@_elementId');
4241
const svg = document.getElementById('radio-svg-@_elementId');
4342
43+
const checkedIcon = '@(Icons.Material.Filled.RadioButtonChecked)';
44+
const uncheckedIcon = '@(Icons.Material.Filled.RadioButtonUnchecked)';
45+
4446
if (radio && svg) {
4547
const handleChange = () => {
46-
const path = svg.querySelector('path:last-child');
47-
48-
if (path) {
49-
path.setAttribute('d', radio.checked ? '@Checked' : '@UnChecked');
50-
}
48+
svg.innerHTML = radio.checked ? checkedIcon : uncheckedIcon;
5149
};
5250
5351
radio.addEventListener('change', handleChange);
@@ -79,6 +77,8 @@
7977
throw new InvalidOperationException($"{nameof(MudStaticRadio<T>)} must be used inside a {nameof(MudStaticRadioGroup<T>)}");
8078
}
8179

80+
var test = Icons.Material.Filled.RadioButtonChecked;
81+
8282
base.OnInitialized();
8383
}
8484

0 commit comments

Comments
 (0)