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

feat(BreadcrumbItem): pass props to li element #5055

Merged
merged 9 commits into from
Mar 23, 2020

Conversation

mxschmitt
Copy link
Member

Closes #5054

@mxschmitt mxschmitt marked this pull request as ready for review March 20, 2020 09:16
@mxschmitt mxschmitt requested review from taion and bpas247 March 20, 2020 09:16
@@ -5137,17 +5137,10 @@ functional-red-black-tree@^1.0.1:
resolved "https://registry.yarnpkg.com/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz#1b0ab3bd553b2a0d6399d29c0e3ea0b252078327"
integrity sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc=

<<<<<<< HEAD
Copy link
Member Author

Choose a reason for hiding this comment

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

there was a merge conflict merged by jquense

Comment on lines 63 to 71
const { href, title, target, listItemProps, ...elementProps } = props;
const linkProps = { href, title, target };

return (
<Component
ref={ref}
className={classNames(prefix, className, { active })}
aria-current={active ? 'page' : undefined}
{...listItemProps}
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
const { href, title, target, listItemProps, ...elementProps } = props;
const linkProps = { href, title, target };
return (
<Component
ref={ref}
className={classNames(prefix, className, { active })}
aria-current={active ? 'page' : undefined}
{...listItemProps}
const { href, title, target, ...props } = props;
const linkProps = { href, title, target };
return (
<Component
ref={ref}
{...props}
className={classNames(prefix, className, { active })}
aria-current={active ? 'page' : undefined}

maybe we can just do this?

Copy link
Member Author

Choose a reason for hiding this comment

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

would break backwards compatibility right? thats why I made this approach.

Copy link
Member

Choose a reason for hiding this comment

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

we're in betas :D

post-#5043 i think it's a reasonable change to make...

Copy link
Member Author

Choose a reason for hiding this comment

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

maybe we should release v1 soon, so that we have at least something for Bootstrap 4.

Then for Bootstrap 5 we can use v2 or instantly jump to v5 idk. (seems to be the user friendly approach for me)

Copy link
Member

Choose a reason for hiding this comment

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

yeah... i guess my concern with matching bootstrap major versions is that it doesn't let us make potentially necessary breaking changes on our end.

part of the question might be how often upstream cuts breaking changes. if it will happen on a semi-regular cadence, then not too big a deal.

if it will be years and years, then we have a bit of a problem

Copy link
Member

@taion taion left a comment

Choose a reason for hiding this comment

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

some minor code cleanups and a small fix.

we may want to add a regression test here around link content

src/BreadcrumbItem.js Outdated Show resolved Hide resolved
src/BreadcrumbItem.js Show resolved Hide resolved
src/BreadcrumbItem.js Outdated Show resolved Hide resolved
src/BreadcrumbItem.js Outdated Show resolved Hide resolved
src/BreadcrumbItem.js Outdated Show resolved Hide resolved
Copy link
Member

@bpas247 bpas247 left a comment

Choose a reason for hiding this comment

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

We should also revert the changes we made to the lockfile, since there shouldn't be any package updates in this PR

Comment on lines 149 to 165
it('Should be able to pass attributes to the link element', () => {
const instance = mount(
<Breadcrumb.Item linkProps={{ foo: 'bar' }}>Crumb</Breadcrumb.Item>,
);
instance
.find('a')
.prop('foo')
.should.eq('bar');
});

it('Should be able to pass attributes to the li element', () => {
const instance = mount(<Breadcrumb.Item foo="bar">Crumb</Breadcrumb.Item>);
instance
.find('li')
.prop('foo')
.should.eq('bar');
});
Copy link
Member

Choose a reason for hiding this comment

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

Could we re-write these tests to make assertions on actual use cases?

Copy link
Member Author

Choose a reason for hiding this comment

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

you mean dont use should.eq?
I adjusted the test names

@@ -8,6 +8,7 @@ export interface BreadcrumbItemProps {
linkAs?: React.ElementType;
target?: string;
title?: React.ReactNode;
linkProps?: React.LinkHTMLAttributes<any>;
Copy link
Member

Choose a reason for hiding this comment

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

Is there a better generic that we can use here other than any?

Copy link
Member Author

Choose a reason for hiding this comment

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

should be okay now. thx

@mxschmitt
Copy link
Member Author

Should be okay now. But unsure regarding the id handling. Before we applied the ID to the link element what we dont do anymore with this implementation. But we have linkProps for that, so idk.

@taion
Copy link
Member

taion commented Mar 23, 2020

@jquense last blocker for v1 here

@taion taion merged commit eb4877f into master Mar 23, 2020
@taion taion deleted the feature/breadcrumbitem-pass-props branch March 23, 2020 18:00
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.

Cannot pass microdata attribute to Breadcrumb.Item
4 participants