Pearson-Higher-Ed / elements-sdk

Base Styling and Atomic JavaScript Components
MIT License
13 stars 13 forks source link

Typography styles can't be @extend'ed inside media queries #31

Open parkerpearson opened 6 years ago

parkerpearson commented 6 years ago

Re-raising this issue since I am running into it again with the design site.

There is no workaround besides copy/pasting the code you want to @extend which is brittle, not sharable, and creates tech debt.

The solution is to provide @mixin versions of the classes we currently use via @extend. Both options are easy to support via:

@mixin pe-page-title {
  font-size: 38px;
  ...
}

.pe-page-title {
  @include pe-page-title;
}

// Now you can either

@extend .pe-page-title;

// Or

@include pe-page-title;
StommePoes commented 6 years ago

Hm. What's the list, or is it just everything in typography?

parkerpearson commented 6 years ago

@StommePoes What I ran into was just .pe-page-title and .pe-page-title--small, but this could apply to any typography class.

antelopeb commented 6 years ago

@parkerpearson is this something you're still interested in? In particular, why is the @extend not working for typography? I feel like I should know this, but I can't remember.

parkerpearson commented 6 years ago

@antelopeb Yes I think it still makes sense to fix, although I don't currently need it as I probably did a manual work around when I was doing the UXF site.

It's not specific to typography, but classes can't be @extend'ed from within a media query. I ran into it with typography where I wanted to change the font size of a heading based on the screen width.