Use a shared util for classNameBindings

Consolidate the logic for classNameBindings into a single utility.