mp

[ASAP] Molecule Property Analyses of Active Compounds for <italic toggle="yes">Mycobacterium tuberculosis</italic>

Journal of Medicinal Chemistry
DOI: 10.1021/acs.jmedchem.9b02075




mp

[ASAP] Synthesis and Structure–Activity Relationships of Arylsulfonamides as AIMP2-DX2 Inhibitors for the Development of a Novel Anticancer Therapy

Journal of Medicinal Chemistry
DOI: 10.1021/acs.jmedchem.9b01961




mp

[ASAP] Discovery, Structure–Activity Relationship, and Biological Activity of Histone-Competitive Inhibitors of Histone Acetyltransferases P300/CBP

Journal of Medicinal Chemistry
DOI: 10.1021/acs.jmedchem.9b02164




mp

[ASAP] Structure-Based Bioisosterism Yields HIV-1 NNRTIs with Improved Drug-Resistance Profiles and Favorable Pharmacokinetic Properties

Journal of Medicinal Chemistry
DOI: 10.1021/acs.jmedchem.0c00117




mp

[ASAP] Correction to Toggling Preassembly with Single-Site Mutation Switches the Cytotoxic Mechanism of Cationic Amphipathic Peptides

Journal of Medicinal Chemistry
DOI: 10.1021/acs.jmedchem.0c00608




mp

[ASAP] Molecular Interactions of Pyrazine-Based Compounds to Proteins

Journal of Medicinal Chemistry
DOI: 10.1021/acs.jmedchem.9b02021




mp

[ASAP] Treating Cancer by Spindle Assembly Checkpoint Abrogation: Discovery of Two Clinical Candidates, BAY 1161909 and BAY 1217389, Targeting MPS1 Kinase

Journal of Medicinal Chemistry
DOI: 10.1021/acs.jmedchem.9b02035




mp

[ASAP] Design, Synthesis, and Mechanism Study of Benzenesulfonamide-Containing Phenylalanine Derivatives as Novel HIV-1 Capsid Inhibitors with Improved Antiviral Activities

Journal of Medicinal Chemistry
DOI: 10.1021/acs.jmedchem.0c00015




mp

[ASAP] Triazolo-Peptidomimetics: Novel Radiolabeled Minigastrin Analogs for Improved Tumor Targeting

Journal of Medicinal Chemistry
DOI: 10.1021/acs.jmedchem.9b01936




mp

[ASAP] Computational Chemistry on a Budget: Supporting Drug Discovery with Limited Resources<subtitle>Miniperspective</subtitle>

Journal of Medicinal Chemistry
DOI: 10.1021/acs.jmedchem.9b02126




mp

[ASAP] Degradation versus Inhibition: Development of Proteolysis-Targeting Chimeras for Overcoming Statin-Induced Compensatory Upregulation of 3-Hydroxy-3-methylglutaryl Coenzyme A Reductase

Journal of Medicinal Chemistry
DOI: 10.1021/acs.jmedchem.0c00339




mp

[ASAP] Ruthenium(II) Complex Containing a Redox-Active Semiquinonate Ligand as a Potential Chemotherapeutic Agent: From Synthesis to <italic toggle="yes">In Vivo</italic> Studies

Journal of Medicinal Chemistry
DOI: 10.1021/acs.jmedchem.0c00431




mp

[ASAP] Molecular Basis for Omapatrilat and Sampatrilat Binding to Neprilysin—Implications for Dual Inhibitor Design with Angiotensin-Converting Enzyme

Journal of Medicinal Chemistry
DOI: 10.1021/acs.jmedchem.0c00441




mp

[ASAP] Chimeric Peptidomimetics of SOCS 3 Able to Interact with JAK2 as Anti-inflammatory Compounds

ACS Medicinal Chemistry Letters
DOI: 10.1021/acsmedchemlett.9b00664




mp

[ASAP] Substituted Naphthalenediimide Compounds Bind Selectively to Two Human Quadruplex Structures with Parallel Topology

ACS Medicinal Chemistry Letters
DOI: 10.1021/acsmedchemlett.0c00041




mp

[ASAP] Characterization of an Alginate Encapsulated LS180 Spheroid Model for Anti-colorectal Cancer Compound Screening

ACS Medicinal Chemistry Letters
DOI: 10.1021/acsmedchemlett.0c00076




mp

[ASAP] Exploring the Implication of DDX3X in DENV Infection: Discovery of the First-in-Class DDX3X Fluorescent Inhibitor

ACS Medicinal Chemistry Letters
DOI: 10.1021/acsmedchemlett.9b00681




mp

[ASAP] Complete Regression of Carcinoma via Combined C-RAF and EGFR Targeted Therapy

ACS Medicinal Chemistry Letters
DOI: 10.1021/acsmedchemlett.0c00159




mp

[ASAP] PROTAC Compounds Targeting a-Synuclein Protein for Treating Neurogenerative Disorders: Alzheimer’s and Parkinson’s Diseases

ACS Medicinal Chemistry Letters
DOI: 10.1021/acsmedchemlett.0c00192




mp

Nesting Components

Using CSS components is somewhat straightforward. We add the markup and give it the component’s class name and all is good. Where it gets trickier is when we try to nest components. And when they need to be tweaked based on the context. Where should the styles be defined? It’s a question I’ve been asking myself a few times and what this article is trying to explore.

Just to clarify before we start, with “CSS components”, I mean the small building blocks that get used to assemble a website or app. Like buttons, inputs, navs, headers etc. Some also call them modules or patterns. Also I’m using the SUIT naming convention in the examples below, but any other convention would be fine as well. And just a heads, there isn’t some awesome solution at the end that solves all the problems. It’s just me whining most of the time.

Ok, best is to go straight into it and look at an example. Let’s say we have a Header component where we would like to add a Button component inside.

<header class=“Header”>
  <button class=“Button”>Button</button>
</header>

Now because the Button is inside the Header, we want to make the Button a bit smaller than it would be on its own.

Here a few approaches how to do that:

Option 1 - Descendant selector

Maybe the most common way is to use a descendant selector to change the font-size whenever a Button is inside a Header.

.Header .Button {
  font-size: .75em;
}

This works great but the question is, where should this rule be added? We probably split our components into separate files, so is it in header.scss or in button.scss? In other words, should the Header know about what other components might get nested or should the Button know in what environment it will get placed?

But wait, the point of creating components is to separate them, make them modular. Each component should be kept isolated and shouldn’t know about other components. So we can make changes, rename or remove them without having to check if they might get used somewhere else.

Option 2 - Variations

Another way is to create variations. We add a .Button--small class that we can use whenever we would like the button to be smaller without having to worry about ancestors.

.Button--small {
  font-size: .75em;
}
<header class=“Header”>
  <button class=“Button Button--small>Button</button>
</header>

This works great too, but could get out of hand quickly. What do you do if at some point you want the font-size to be .9em? Create yet another variation? Button--justALittleSmaller. As the project keeps growing, the number of variations will too. We will start to loose sight where they actually get used and we’re not sure anymore if we can change a variation or if it will have side effects in some other place. We could create “contextual” variations like Button--header or Button--footer, but then we’re back at the beginning and could just as well use “descendant selectors”.

Same goes for using states. .Button.is-small should only be used if there is a change in state and not to fit a certain context.

Option 3 - Adopted Child

I can’t remember where I read about this approach but somehow it stuck with me. I also forgot how it was called. So for now I’ll just call it “Adopted Child”.

Let’s switch it around and look at it from the Header’s perspective. What would we do if we wouldn’t know what the components are called that might get nested? But we know that we want to make them a bit smaller. Well, we probably would create a generic .Header-item class and use it like this:

.Header-item {
  font-size: .75em;
}
<header class=“Header”>
  <div class=“Header-item”></div>
</header>

Ok, that gets us a bit closer. Now, it’s probably strange saying it like that when talking about CSS, but what would we do if we don’t want to create an own child, but still have one. Right, we could adopt one. In our example we adopt a Button component as our own child. We didn’t create it, but now we can tweak.. erm.. I mean “raise” it like it’s our own:

// born in button.scss
.Button {
  font-size: 1em;
}

// raised in header.css
.Header .Header-item {
  font-size: .75em;
}
<header class=“Header”>
  <button class=“Header-item Button>Button</button>
</header>

It is a bit uncommon that the same HTML element shares classes from two different components. And it’s not without any risks. More about them later. But I really like this approach because it keeps the components independent without having to know about each other.

Another nice thing is that if we want to add other components to the Header that also need the same adjustments, we can reuse the same Header-item class, like for example on a text Input.

<header class=“Header”>
	<input class=“Header-item Input>
  <button class=“Header-item Button>Button</button>
</header>

Ok, about those risks. Well, depending on what properties we wanna change, it might not always be ideal. For example, because the Button already had font-size defined, we had to increase specificity by using .Header .Header-item. But that would also override variations like .Button--small. That might be how we want it, but there are also situations where we’d like the variation to always be “stronger”. An example would be when changing colors. When the color of Buttons should be different inside a Header, but not when its a variation, like .Button—primary. Yeah, we could take a look inside button.scss or our style-guide, but remember our goal.. we actually don’t want to make decisions by looking how other components are made.

So, as a general rule, don’t use “adopted children” for any properties that are theme related and only where you can be sure that you want to override them all the time. Like for layout/size related properties or adjusting the position.

More options?

There are some more ways to do contextual styling that came to mind. I’ll just mention them briefly for completeness, but think the 3 above are better suited.

Option 4 - We could use a preprocessor to extend an existing component. In our example it would be a clone of the Button with some tweaks added and used as a new child component .Header-button. Now we only rely that the Button exists in the source, but don’t have to worry about other contexts. Downside is inflating our CSS output. As well as having to remember lots of new child component classes.

Option 5 - We could create a utility class like .u-small. It’s similar to variations, but not scoped to a single component and could be used for other components as well. And for that reason it becomes very risky to ever change later.

Option 6 - And of course, we could use inline styles. But I would leave that to JavaScript only.


So after all that, which is best? I’m afraid there isn’t a clear winner. It would be nice to keep it consistent with a single approach throughout the entire project, but I guess we just have to decide on a per case basis:

  1. Descendant selectors if we can expect that components don’t change much. Like when using a UI Kit or library.
  2. Variations if it makes sense that a component has different versions that get reused anyways, and not just for a specific context.
  3. Adopted Child for layout, sizing, positioning or where we are sure to always want to override a property. Also for changing multiple child components at once.
  4. Extending when we truly want the components to be separated and don’t mind inflating the CSS output.
  5. Utilities for very specific things, that once the class is defined, it will never change, like clearing floats.
  6. Inline styles if it needs to be dynamically added with JavaScript.

As said at the beginning, I haven’t found a “fits all” solution and maybe the conclusion is: Try to keep contextual styling to a minimum.

Updates

The “Adopted Child” approach is called “Mixes” in BEM. Here some more infos.


SUIT also recommends using “Adopted Child/Mixes”. But also another option:

Option 7 - Adding a wrapper element. It’s the <div class="Excerpt-wrapButton"> in that example. I think it works great in most cases. But for example when using Flexbox, because it has this parent/child relationship, adding an extra wrapper in between would break it. And then you might still need to set the width of the wrapped component to 100% or so. Anyways, this is a great addition. Thanks Pablo in the comments.


Option 8 - Single Purpose Classes. It’s where every class has only a single property. It’s somewhere between utilities (Option 5) and inline styles (Option 6). Atomic CSS and Tachyons use this approach. I haven’t used them on a real project, but just from looking at it, the concerns are similar to the ones from utilities. If you want to change the value in a SP class, it seems unpredictable. Because in another place (where that same class is used), you might want to keep the current value. So you would have to first check if the change has any unwanted effects somewhere else.




mp

Thanks to Covid-19, Website Accessibility Has Never Been More Important

The first global pandemic of the digital era is upon us. We’re living in unprecedented and uncomfortable times. For our senior citizens, these past several weeks have been particularly discomforting. According to the CDC, men and women over the age of 65 are significantly more likely to develop complications from COVID-19. As we seek to […]




mp

Inventing Boston: design, production, and consumption / Edward S. Cooke, Jr

Rotch Library - NK838.B67 C66 2019




mp

Altered states: Substanzen in der zeitgenössischen Kunst = substances in contemporary art / herausgegeben von = edited by Milena Mercer ; Texte = texts, Max Daly ... [and thirteen others]

Rotch Library - N8251.S555 A48 2018




mp

Jakob Mohr / herausgegeben von Doris Noell-Rumpeltes + Thomas Röske

Rotch Library - NC251.M64 J35 2018




mp

Photography reframed: new visions in contemporary photographic culture / edited by Ben Burbridge and Annebella Pollen

Rotch Library - TR185.P52 2018




mp

Harry Clarke and artistic visions of the new Irish state / edited by Angela Griffin, Marguerite Helmers & Róisín Kennedy

Rotch Library - NK5398.C64 H37 2019




mp

Modernists & mavericks: Bacon, Freud, Hockney & the London painters / Martin Gayford

Rotch Library - ND470.G39 2018




mp

Situating global art: topologies, temporalities, trajectories / Sarah Dornhof, Nanne Buurman, Birgit Hopfener, Barbara Lutz (eds.)

Rotch Library - N72.G55 S58 2018




mp

For want of a nail / Amy Franceschini & Michael Swaine, Futurefarmers

Rotch Library - N7433.4.F73 F67 2019




mp

Aquatint worlds: travel, print, and empire, 1770-1820 / Douglas Fordham

Rotch Library - N8258.F67 2019




mp

The art of return: the sixties & contemporary culture / James Meyer

Rotch Library - N6512.M479 2019




mp

Trouble with women artists: reframing the history of art / Laure Adler & Camille Viéville ; translated from the French by Kate Robinson

Rotch Library - N8354.A3513 2019




mp

Indian life and people in the 19th century: company paintings in the TAPI Collection / J.P. Losty ; with an introduction by John Keay

Rotch Library - ND2048.L67 I53 2019




mp

Inside Tangier: houses & gardens / Nicolò Castellini Baldissera ; photography, Guido Taroni ; foreword, Hamish Bowles

Rotch Library - NK2087.75.A1 B35 2019




mp

Arabicity: contemporary Arab art / edited by Rose Issa and Juliet Cestar ; contributions by Rose Issa, Georges Corm, Michket Krifa, Etel Adnan

Rotch Library - N7265.3.A733 2019




mp

Leonardo by Leonardo / Martin Kemp

Rotch Library - ND623.L5 K43 2019




mp

Painting with fire: Sir Joshua Reynolds, photography, and the temporally evolving chemical object / Matthew C. Hunter

Online Resource




mp

The Gauguin atlas / Nienke Denekamp ; translated by Laura Watkinson

Rotch Library - ND553.G27 D4613 2019




mp

Beauty in the age of empire: Japan, Egypt, and the global history of aesthetic education / Raja Adal

Rotch Library - NX384.A1 A33 2019




mp

Constructing imperial Berlin: photography and the metropolis / Miriam Paeslack

Rotch Library - TR74.B47 P34 2019




mp

Experimental Beijing: gender and globalization in Chinese contemporary art / Sasha Su-Ling Welland

Rotch Library - N7345.6.W46 2018




mp

Shifting grounds: landscape in contemporary Native American art / Kate Morris

Rotch Library - N8213.M696 2019




mp

Affect, emotion, and subjectivity in early modern Muslim Empires: new studies in Ottoman, Safavid, and Mughal art and culture / edited by Kishwar Rizvi

Rotch Library - NX650.E46 A39 2018




mp

Modernism on the Nile: art in Egypt between the Islamic and the contemporary / Alex Dika Seggerman

Rotch Library - N7381.7.S44 2019




mp

A fragile inheritance: radical stakes in contemporary Indian art / Saloni Mathur

Rotch Library - N7304.M384 2019




mp

Queer art camp superstar: decoding the cinematic cyberworld of Ryan Trecartin / Ricardo E. Zulueta

Rotch Library - N6537.T665 Z85 2018




mp

Greek art & archaeology: c. 2500 - c. 150 BCE / Richard T. Neer

Dewey Library - N5630.N44 2018




mp

The album of the world emperor: cross-cultural collecting and the art of album-making in seventeenth-century Istanbul / Emine Fetvaci

Rotch Library - ND2955.F43 2019




mp

Leonardo da Vinci: the 100 milestones / Martin Kemp

Rotch Library - N6923.L33 K449 2019




mp

Designs for different futures / Kathryn B. Hiesinger & Michelle Millar Fisher, Emmet Byrne, Maite Borjabad López-Pastor & Zoë Ryan ; with Andrew Blauvelt, Colin Fanning, and Orkan Telhan ; contributions by Juliana Rowen Barton [and 24 o

Rotch Library - NK1397.D483 2019