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

feat(factories): createShorthandFactory API update and removing HTML factories#376

Merged
bmdalex merged 16 commits intomasterfrom
feat/slot-factory
Nov 15, 2018
Merged

feat(factories): createShorthandFactory API update and removing HTML factories#376
bmdalex merged 16 commits intomasterfrom
feat/slot-factory

Conversation

@bmdalex
Copy link
Collaborator

@bmdalex bmdalex commented Oct 19, 2018

feat(factories): createShorthandFactory API update and removing HTML factories

This PR focuses on:

  • removing regular HTML factories from lib/factories.tsx
  • updating createShorthandFactory API to use mappedProp as string instead of mapValueToProps function
  • adding Slot.create and Slot.createHTMLElement functions
  • updating usage
  • adding UTs

TODO

  • Conformance test
  • Update the CHANGELOG.md

API Proposal

import { createHTMLInput } from 'src/lib'

// usage
createHTMLInput(
  'text',
  { defaultProps: { ... }, overrideProps: { ... } }
)

New

import Slot from 'src/components/Slot'

// usage
Slot.createHTMLElement(
  shorthandProp,
  { defaultProps: { as: 'input', ... }, overrideProps: { ... } }
)

The advantages of the new API is that it will create a Stardust Slot component and render it as an input element (see as property in the usage), which means it will have all Stardust features for:

  • behavior
  • accessibility
  • styling

@mnajdova
Copy link
Contributor

Just additional thought. It would be really beneficial if the user can use the Slot as any other stardust component, because there will be out of the box support for styles, variables, rtl etc. Meaning in any place, where at this moment we are using div in the prototypes, we would use the Slot component.

@bmdalex
Copy link
Collaborator Author

bmdalex commented Oct 19, 2018

@mnajdova
totally agree on that but I need some evidence (through user scenarios) that there is a real need for it; is there anything preventing the user to do that now? or is it just the fact that we don't export Slot in index.tsx?

@bmdalex bmdalex force-pushed the feat/slot-factory branch 2 times, most recently from c4bb67d to 6878e49 Compare October 19, 2018 11:56
@codecov
Copy link

codecov bot commented Oct 19, 2018

Codecov Report

Merging #376 into master will decrease coverage by 0.02%.
The diff coverage is 97.61%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #376      +/-   ##
==========================================
- Coverage   88.38%   88.36%   -0.03%     
==========================================
  Files          41       41              
  Lines        1421     1418       -3     
  Branches      206      206              
==========================================
- Hits         1256     1253       -3     
  Misses        161      161              
  Partials        4        4
Impacted Files Coverage Δ
src/components/Accordion/AccordionTitle.tsx 65% <100%> (ø) ⬆️
src/components/Popup/PopupContent.tsx 100% <100%> (ø) ⬆️
src/components/Chat/ChatMessage.tsx 96.29% <100%> (ø) ⬆️
src/components/Segment/Segment.tsx 100% <100%> (ø) ⬆️
src/components/Input/Input.tsx 100% <100%> (ø) ⬆️
src/components/Icon/Icon.tsx 84% <100%> (ø) ⬆️
src/components/Text/Text.tsx 100% <100%> (ø) ⬆️
src/components/Form/FormField.tsx 100% <100%> (ø) ⬆️
src/components/Slot/Slot.tsx 100% <100%> (ø) ⬆️
src/components/Header/HeaderDescription.tsx 100% <100%> (ø) ⬆️
... and 13 more

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 267b46a...47a59dc. Read the comment docs.

@mnajdova
Copy link
Contributor

mnajdova commented Oct 19, 2018

The benefit is that there will be out of the box support for styles, variables, rtl etc, which is very important. Otherwise, using divs, labels and any other HTML elements doesn't support this. I already used the Slot in some of the prototypes and I consider it really valuable from user's perspective. Not sure that now the user can use the Slot from the library as we don't export it as a regular component.

@levithomason levithomason added needs author changes Author needs to implement changes before merge and removed 🚀 ready for review labels Oct 22, 2018
@bmdalex bmdalex force-pushed the feat/slot-factory branch 3 times, most recently from 95044b6 to 902b447 Compare October 22, 2018 17:30
@bmdalex bmdalex added question Further information is requested, concerns that require additional thought are raised 🚀 ready for review and removed needs author changes Author needs to implement changes before merge labels Oct 22, 2018
@bmdalex
Copy link
Collaborator Author

bmdalex commented Oct 22, 2018

In reply to @mnajdova 's comment, do we want to expose the Slot component as a component to users?

@levithomason @kuzhelov

@bmdalex bmdalex force-pushed the feat/slot-factory branch 3 times, most recently from a6a98f1 to a6c2bb2 Compare October 23, 2018 10:42
@bmdalex bmdalex force-pushed the feat/slot-factory branch 2 times, most recently from f45e641 to 0987b5b Compare October 31, 2018 16:46
@bmdalex bmdalex self-assigned this Nov 13, 2018
@bmdalex bmdalex force-pushed the feat/slot-factory branch 3 times, most recently from a1d2c33 to 7a3efe4 Compare November 13, 2018 13:07
@bmdalex bmdalex mentioned this pull request Nov 14, 2018
6 tasks
manajdov and others added 9 commits November 14, 2018 16:39
# Conflicts:
#	src/components/Attachment/Attachment.tsx
#	src/components/Form/FormField.tsx
#	src/components/Input/Input.tsx
#	src/components/Slot/Slot.tsx
#	src/lib/factories.tsx
#	test/specs/components/Slot/Slot-test.ts
# Conflicts:
#	src/components/Chat/ChatItem.tsx
#	src/components/Chat/ChatMessage.tsx
#	src/components/Segment/Segment.tsx
#	src/components/Slot/Slot.tsx
@bmdalex bmdalex changed the title feat(slot): slot factory proposal feat(factories): createShorthandFactory API update and removing HTML factories Nov 15, 2018
@bmdalex bmdalex removed the question Further information is requested, concerns that require additional thought are raised label Nov 15, 2018
Copy link
Member

@levithomason levithomason left a comment

Choose a reason for hiding this comment

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

Merge after removing Slot.createHTMLElement() 👍

@bmdalex bmdalex merged commit 723f829 into master Nov 15, 2018
@bmdalex bmdalex deleted the feat/slot-factory branch November 15, 2018 16:22
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.

4 participants