Skip to content
This repository has been archived by the owner on Mar 4, 2020. It is now read-only.

feat(theming): exporting slot's classNames form components #827

Merged
merged 5 commits into from
Feb 4, 2019

Conversation

mnajdova
Copy link
Contributor

@mnajdova mnajdova commented Feb 1, 2019

This PR fixes #784 by adding slotClassNames static fields int he component which have already specified some custom classNames for the slots.

BREAKING CHANGES

The classNames for the slots in the ItemLayout component have been renamed. Please replace the following selectors accordingly:

import { ItemLayout } from '@stardust-ui/react'

ui-item-layout__header <=> ItemLayout.slotClassNames.header
ui-item-layout__headerMedia <=> ItemLayout.slotClassNames.headerMedia
ui-item-layout__main <=> ItemLayout.slotClassNames.main
ui-item-layout__content <=> ItemLayout.slotClassNames.content
ui-item-layout__contentMedia <=> ItemLayout.slotClassNames.contentMedia
ui-item-layout__media <=> ItemLayout.slotClassNames.media
ui-item-layout__endMedia <=> ItemLayout.slotClassNames.endMedia

Question

Do we want to introduce slot's classes for the slots inside the component which are created with the Box or Text component? It seems reasonable to me, as these components can be heavily used in the content of the components, so selecting the slot's containers might be tricky... On the other hand, they can be styled via the slot's inside the component styles, but still creating selectors for them if necessary can be tricky.. Let me know what you think!

Decision

We will add them if there is requirement from the users.

startArea && 'ui-layout--reduced__start',
mainArea && 'ui-layout--reduced__main',
endArea && 'ui-layout--reduced__end',
startArea && Layout.slotClassNames.reducedStart,
Copy link
Contributor Author

@mnajdova mnajdova Feb 1, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if this is the right convention, as the className here is changed because of a prop...

@@ -175,8 +187,8 @@ class ItemLayout extends UIComponent<ReactProps<ItemLayoutProps>, any> {
const mainArea = renderMainArea(this.props, this.state, classes)
const endArea = endMedia

const mergedMediaClasses = cx('ui-item-layout__media', classes.media)
Copy link
Contributor Author

@mnajdova mnajdova Feb 1, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ups, breaking changes introduced. It seems that the classNames of this slots were not correct...

@mnajdova mnajdova added the question Further information is requested, concerns that require additional thought are raised label Feb 1, 2019
@codecov
Copy link

codecov bot commented Feb 4, 2019

Codecov Report

Merging #827 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #827   +/-   ##
=======================================
  Coverage   93.54%   93.54%           
=======================================
  Files          21       21           
  Lines         728      728           
  Branches       73       73           
=======================================
  Hits          681      681           
  Misses         47       47

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 973c9ef...a8cc5a2. Read the comment docs.

@mnajdova mnajdova added 🚀 ready for review and removed question Further information is requested, concerns that require additional thought are raised 🚧 WIP labels Feb 4, 2019
CHANGELOG.md Outdated
@@ -17,8 +17,12 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm

## [Unreleased]

### BREAKING CHANGES
- Renamed classNames for the slots inside the `ItemLayout` component @mnajdova ([#827](https://github.com/stardust-ui/react/pull/827))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lets do either 'class names' or 'classNames'. I would suggest the first option, as it is more correct and implementation agnostic :)

CHANGELOG.md Outdated
### Features
- Accessibility for menu divider @jurokapsiar ([#822](https://github.com/stardust-ui/react/pull/822))
- Added slotClassNames in `ChatMessage`, `ChatItem`, `Dropdown`, `ItemLayout`, `Layout`, `MenuItem` @mnajdova ([#827](https://github.com/stardust-ui/react/pull/827))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would suggest just 'slot class names'

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Export slot's classNames as static fields from the Component
3 participants