-
Notifications
You must be signed in to change notification settings - Fork 1
Description
Hi, I’ve been working with the Adapter class and appreciate the way it isolates styles for components. However, I’d like to share some feedback about the current string-based CSS approach:
-
Hard to Write and Debug: Writing styles as strings can feel unintuitive. Without auto-complete or syntax checking, it’s easy to make mistakes, and catching them often only happens at runtime.
-
Lack of Integration with Tools: IDE features like IntelliSense, auto-complete, and TypeScript support are unavailable for string-based CSS. These are tools I rely on heavily to code efficiently.
-
Doesn’t Feel Like JavaScript: Modern JavaScript often uses object-based styles, where properties like background-color are converted to camelCase (backgroundColor). It’s cleaner, aligns with JavaScript conventions, and is easier to work with in dynamic contexts.
For example, instead of this:
const cardStyle = `
display: block;
min-height: 5rem;
width: 100%;
color: red;
`;
I’d prefer this:
const cardStyle = {
display: "block",
minHeight: "5rem",
width: "100%",
color: "red",
};
This approach:
Makes styles easier to write and maintain.
Allows tools like auto-complete and type checking to catch errors early.
Aligns better with the JavaScript ecosystem.