-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
iconName => icon prop #2070
iconName => icon prop #2070
Conversation
fix testsPreview: documentation | landing | table |
fix icons docsPreview: documentation | landing | table |
bring back LegacyIconName (one big break per PR)Preview: documentation | landing | table |
can you update the prop renaming script to include |
semantic merge conflictsPreview: documentation | landing | table |
add iconName to rename scriptPreview: documentation | landing | table |
582182e
to
f3c805a
Compare
add iconName to rename scriptPreview: documentation | landing | table |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add a docs example that demonstrates a custom SVG icon in a MenuItem (our original internal use case for this)?
*/ | ||
iconName?: LegacyIconName; | ||
icon: LegacyIconName | JSX.Element | false | null | undefined; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is pretty unintuitive, so you should leave clearer documentation on why would a user want to use this with JSX.Element
since it's just a pass-through render. the short answer is: they wouldn't. it's only there to make our codebase cleaner since <Icon>
is used everywhere.
import { IconClasses } from "@blueprintjs/core"; | ||
<Icon iconName={IconClasses.ALIGN_LEFT} iconSize={Icon.SIZE_LARGE} /> | ||
<Icon iconName="globe" iconSize={20} /> | ||
<Icon iconName="graph" iconSize={Icon.SIZE_LARGE} intent={Intent.PRIMARY} /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
need to update these usage docs
|
||
it("iconName=undefined renders nothing", () => { | ||
const icon = shallow(<Icon iconName={undefined} />); | ||
it("passes through icon element unchanged", () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also leave that documentation here, to explain why we're supporting this weird prop
@@ -57,3 +59,12 @@ export class MenuExample extends BaseExample<{}> { | |||
); | |||
} | |||
} | |||
|
|||
const PalantirLogo: React.SFC = () => ( | |||
<svg className={Classes.ICON} width="16" height="16" viewBox="0 0 18 23" xmlns="http://www.w3.org/2000/svg"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@adidahiya maybe some props should be passed into given icon element?
especially if it's an svg
element: className
, iconSize
, color
.
or we could support a paths
prop?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no, I'd rather not add that complexity to <Icon>
add custom svg icon itemPreview: documentation | landing | table |
Merge branch 'develop' of github.com:palantir/blueprint into gg/icon-propPreview: documentation | landing | table |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
icons page is broken
@@ -57,3 +59,12 @@ export class MenuExample extends BaseExample<{}> { | |||
); | |||
} | |||
} | |||
|
|||
const PalantirLogo: React.SFC = () => ( | |||
<svg className={Classes.ICON} width="16" height="16" viewBox="0 0 18 23" xmlns="http://www.w3.org/2000/svg"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no, I'd rather not add that complexity to <Icon>
icons page fixed |
bold icon namesPreview: documentation | landing | table |
Fixes #2066
Checklist
Changes proposed in this pull request:
Icon
iconName?: IconName
=>icon?: LegacyIconName | JSX.Element | false | null | undefined
icon?: IconName | JSX.Element
leftIconName
,rightIconName
get the same treatment