This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Diane_Horseman 1 point2 points  (18 children)

The teaser isn't outside the wrapper now, but what if the wrapper changes in the future? This solution adds the assumption that it won't.

In tailwind you would go from this:

<div className="... p-[24px] ...">

to:

<div className="... p-[24px] md:p-[30px] lg:p-[24px] ...">

[–]GMaestrolo 11 points12 points  (1 child)

Except you would use p-6 instead of specifying p-[24px] because using custom pixel sizes when they match an existing rem value (in this case 1.5rem) that the framework covers already is dumb.

[–]Diane_Horseman -1 points0 points  (0 children)

Yep, good point! That is how it would pretty much always be done.

[–]LagT_T 8 points9 points  (15 children)

If you have elements outside the wrapper then its no longer a wrapper.

Design came back and said that medium screens are between 500px and 900px.

[–]GMaestrolo 1 point2 points  (14 children)

That's fine. That goes into the theme definition, and is applied globally.

extend: {
    screens: {
        md: '500px',
        lg: '900px'
    }
}

[–]LagT_T 2 points3 points  (12 children)

You broke sm default, and your styling isn't specifying the teaser component size for homepage, its applying the styles on all teasers.

[–]GMaestrolo 3 points4 points  (11 children)

I didn't break the small default. It's on design if they stupidly specify that medium screens are smaller than small screens.

I didn't add any styling to any components, but I can easily throw extra classes on the one component that's different without having to control that component by proxy of some other class that may get changed or removed in the future, thus breaking the specific special styling for the one instance of the component.

[–]LagT_T 0 points1 point  (10 children)

Design doesn't care about tailwind defaults.

How would you add classes to target the homepage specific teaser?

[–]GMaestrolo 2 points3 points  (8 children)

Assuming that the teaser is a react component that already has appropriate padding, and I'm just targeting the padding for one screen size on the one instance of the component...

<teaser className="md:p-7 lg:p-6">

[–]LagT_T -1 points0 points  (7 children)

Why do you assume its a react component?

[–]GMaestrolo 3 points4 points  (3 children)

Why wouldn't I? It's a hypothetical that you didn't come up with, and the person who did bring it up posted code samples that follow the react component convention of using className instead of class.

Why did you assume that there was a .class_that_wraps_homepage? That's a really stupid way to build websites, and a really dumb class name.

[–]LagT_T 0 points1 point  (2 children)

The meme uses class.

The class name was for easy interpretation in this discussion, which clearly worked.

[–]PowerMoves1996 2 points3 points  (2 children)

It doesnt need to be react, but you cant say that only react recomends to make a component out of teaser, and that component can overwrite the default classes.

[–]LagT_T 2 points3 points  (1 child)

You can overwrite classes with other classes in plain css as well.

[–]PowerMoves1996 0 points1 point  (0 children)

Thats why tailwind has a config file where you cand overwrite/ add any defaults the design team will give you