Short answer, no. Dynamic classes and conditional visibility both differ from xpaths. In xpaths this would indeed be valid. I would suggest looking at the answer of Rishadh, on the same question.
Also you’re adding inline styling this way instead of a class. Make sure to add a class with this specific styling to the scss file(s) and use a class here.
I have answered this in your last question,
Hope it helps!