Skip to content
This repository was archived by the owner on Apr 26, 2024. It is now read-only.

feature: [Text] Add isParagraph props#60

Merged
mmv08 merged 7 commits intodevelopmentfrom
textSpanOrParagraph
Aug 26, 2020
Merged

feature: [Text] Add isParagraph props#60
mmv08 merged 7 commits intodevelopmentfrom
textSpanOrParagraph

Conversation

@nicosampler
Copy link
Contributor

This Pull Request adds a prop isParagraph to Text component.

When isParagraph (default true) Text is wrapped into a <p> element.
When isParagraph is false, Text is Wrapped into a <span> element.

@github-actions
Copy link

github-actions bot commented Aug 20, 2020

ESLint Summary View Full Report

Annotations are provided inline on the Files Changed tab. You can also see all annotations that were generated on the annotations page.

Type Occurrences Fixable
Errors 0 0
Warnings 0 0
Ignored 0 N/A
  • Result: ✅ success
  • Annotations: 0 total

Report generated by eslint-plus-action

@ghost
Copy link

ghost commented Aug 20, 2020

Travis automatic deployment:
https://pr60--safereactcomponents.review.gnosisdev.com

Copy link
Contributor

@mmv08 mmv08 left a comment

Choose a reason for hiding this comment

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

I think this would be better if we would add a prop for element. E.g <Text is='span' />. Boolean API like this would make adding other elements harder.

Also there are other libraries with such API and imo it would be more familiar for the developers

@nicosampler
Copy link
Contributor Author

@mikheevm Agreed with the syntax, but I can not imagine another component to be used furthermore than p and span. If you can imagine another, I will change the prop name.

@mmv08
Copy link
Contributor

mmv08 commented Aug 21, 2020

@nicosampler abbr, code, small, b, sub, samp, time, sup, strong. Since we have only 1 generic component for text and there's more than 1 html tag for text, there's a possibility that we may want to support this in future.

@nicosampler
Copy link
Contributor Author

we are already covering some of them but agreed that some others could be supported as well in the future.

@ghost
Copy link

ghost commented Aug 21, 2020

Travis automatic deployment:
https://pr60--safereactcomponents.review.gnosisdev.com

@ghost
Copy link

ghost commented Aug 21, 2020

Travis automatic deployment:
https://pr60--safereactcomponents.review.gnosisdev.com

@nicosampler nicosampler requested a review from mmv08 August 21, 2020 20:06
@ghost
Copy link

ghost commented Aug 21, 2020

Travis automatic deployment:
https://pr60--safereactcomponents.review.gnosisdev.com

HTMLParagraphElement | HTMLSpanElement,
Props
>(({ is = 'paragraph', children, ...rest }, ref) =>
is === 'paragraph' ? (
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This produces a lot of problems with typescript, how would you pass the Props and also with the ref.
how do you suggest to fix them?

Copy link
Contributor

Choose a reason for hiding this comment

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

https://styled-components.com/docs/api#as-polymorphic-prop

looks like styled-components has support for that. Could you please check it again and see if any errors pop up?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

nice!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

works like a charm!

@ghost
Copy link

ghost commented Aug 24, 2020

Travis automatic deployment:
https://pr60--safereactcomponents.review.gnosisdev.com

@nicosampler nicosampler requested a review from mmv08 August 25, 2020 12:35
@ghost
Copy link

ghost commented Aug 25, 2020

Travis automatic deployment:
https://pr60--safereactcomponents.review.gnosisdev.com

@ghost
Copy link

ghost commented Aug 25, 2020

Travis automatic deployment:
https://pr60--safereactcomponents.review.gnosisdev.com

@mmv08 mmv08 merged commit 920a6d3 into development Aug 26, 2020
@mmv08 mmv08 deleted the textSpanOrParagraph branch August 26, 2020 11:24
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants