Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Core, Docs] add additional props to Hr component #37

Merged
merged 7 commits into from
May 9, 2021

Conversation

khushal87
Copy link
Contributor

@khushal87 khushal87 commented May 7, 2021

This PR introduces new props to the Hr component. The props are:

  • subHeader
  • subHeaderProps
  • orientation

Have I added the tests/tested my changes?
Yes

Have I updated the docs for the changes?
Yes

Reference issue: #28

@khushal87 khushal87 changed the base branch from master to next-1.1.0 May 7, 2021 07:38
@rtivital
Copy link
Member

rtivital commented May 7, 2021

About inset – currently it feels very complicated, I think it's not necessary as margin can achieve this in single prop + inset is fixed, it is impossible to connect it to layout:

<Hr style={{ marginLeft: 70 }} />
// same as 
<Hr inset={true} insetType="left" />

@rtivital
Copy link
Member

rtivital commented May 7, 2021

First demo does not show dashed variant
Screen Shot 2021-05-07 at 11 00 02 AM

@khushal87
Copy link
Contributor Author

khushal87 commented May 7, 2021

About inset – currently it feels very complicated, I think it's not necessary as margin can achieve this in single-prop + inset is fixed, it is impossible to connect it to layout:

<Hr style={{ marginLeft: 70 }} />
// same as 
<Hr inset={true} insetType="left" />

So adding an insetLength can work? Or do you want the removal of the inset prop? My purpose of having an inset is that it is very common to the Dividers today, and people don't generally feel adding additional styles unnecessarily to it

@khushal87
Copy link
Contributor Author

First demo does not show dashed variant
Screen Shot 2021-05-07 at 11 00 02 AM

Fixed. Thanks for reporting.

src/mantine-core/src/Hr/Hr.tsx Outdated Show resolved Hide resolved
src/mantine-core/src/Hr/Hr.styles.ts Outdated Show resolved Hide resolved
src/mantine-core/src/Hr/Hr.styles.ts Outdated Show resolved Hide resolved
@rtivital
Copy link
Member

rtivital commented May 7, 2021

So adding an insetLength can work? Or do you want the removal of the inset prop? My purpose of having an inset is that it is very common to the Dividers today, and people don't generally feel adding additional styles unnecessarily to it

No, I think, insetLength will bring even more complexity – it'll be 3 props to set single margin, does not feel right.

@khushal87
Copy link
Contributor Author

So adding an insetLength can work? Or do you want the removal of the inset prop? My purpose of having an inset is that it is very common to the Dividers today, and people don't generally feel adding additional styles unnecessarily to it

No, I think, insetLength will bring even more complexity – it'll be 3 props to set single margin, does not feel right.

Okay, will remove it.

@rtivital
Copy link
Member

rtivital commented May 7, 2021

subHeaderProps will be Record<string, any>

@khushal87
Copy link
Contributor Author

khushal87 commented May 7, 2021

subHeaderProps will be Record<string, any>

Wouldn't it be simply TextProps?
subHeaderProps?: TextProps;

@rtivital
Copy link
Member

rtivital commented May 7, 2021

Wouldn't it be simply TextProps?
subHeaderProps?: TextProps;

This will break component props table

@khushal87
Copy link
Contributor Author

khushal87 commented May 7, 2021

Wouldn't it be simply TextProps?
subHeaderProps?: TextProps;

This will break component props table

Even LoadingOverlay uses LoaderProps. It works fine according to me.
sgdhsjs

@rtivital
Copy link
Member

rtivital commented May 7, 2021

Oh, okay, looks good, I was having lots of issues with prop types generator, I think I accidentally fixed them sometime 😄

@khushal87
Copy link
Contributor Author

khushal87 commented May 7, 2021

@rtivital I was going through the code and then I realized if we could export the StyleProps too from the styles.tsx of every components this will improve the reusability of all the components styles. Suppose I need subheaderProps styles to be of type TextStyleProps this would get easier. What is your opinion on it?
We can do it individually or by making a file that firstly imports this style from every styles.tsx of component and then export it.

@rtivital
Copy link
Member

rtivital commented May 7, 2021

I prefer to keep all props description in open place – component props interface – this way you don't need to jump between files to edit them

@khushal87
Copy link
Contributor Author

I prefer to keep all props description in open place – component props interface – this way you don't need to jump between files to edit them

What I mean is if we can export TextStylesProps someway and then import it in other style files this would add flexibility. For my usecase if I want to apply color here in subHeader then I have to assign the type of subHeaderProps in Hr.styles.tsx to TextStylesProps which seems impossible now. Did you understand what I mean?

@rtivital
Copy link
Member

rtivital commented May 7, 2021

Yep, I've tried to do so, unfortunately there is no good solution to this. TextStylesProps does not include all Text component props and has required theme field

@khushal87
Copy link
Contributor Author

Yep, I've tried to do so, unfortunately there is no good solution to this. TextStylesProps does not include all Text component props and has required theme field

Oh, yes it doesn't have all, need to think some other way around.

@rtivital
Copy link
Member

rtivital commented May 7, 2021

Record<string, any> is still the best option

@khushal87
Copy link
Contributor Author

Record<string, any> is still the best option

Yes, for the style, let me see if this works.

@khushal87 khushal87 marked this pull request as ready for review May 8, 2021 08:39
Copy link
Member

@rtivital rtivital left a comment

Choose a reason for hiding this comment

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

Great work @khushal87, please fix these issue

docs/src/docs/demos/core/Hr/hr.demos.tsx Outdated Show resolved Hide resolved
docs/src/docs/demos/core/Hr/hr.demos.tsx Outdated Show resolved Hide resolved
docs/src/docs/demos/core/Hr/hr.demos.tsx Outdated Show resolved Hide resolved
docs/src/docs/demos/core/Hr/hr.demos.tsx Outdated Show resolved Hide resolved
docs/src/docs/demos/core/Hr/hr.demos.tsx Outdated Show resolved Hide resolved
src/mantine-core/src/Hr/Hr.tsx Outdated Show resolved Hide resolved
src/mantine-core/src/Hr/Hr.tsx Outdated Show resolved Hide resolved
src/mantine-core/src/Hr/Hr.tsx Outdated Show resolved Hide resolved
src/mantine-core/src/Hr/Hr.tsx Outdated Show resolved Hide resolved
src/mantine-core/src/Hr/Hr.tsx Outdated Show resolved Hide resolved
@khushal87
Copy link
Contributor Author

@rtivital Done.

@rtivital
Copy link
Member

rtivital commented May 9, 2021

Thanks! Great work!

@rtivital rtivital merged commit f3a8b8a into mantinedev:next-1.1.0 May 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants