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] support dark intent colors on icons #2541

Merged
merged 2 commits into from
May 29, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion packages/core/src/components/icon/_icon.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,13 @@
#{$icon-classes} {
display: inline-block;

@each $intent, $color in $pt-intent-colors {
@each $intent, $color in $pt-intent-text-colors {
&.#{$ns}-intent-#{$intent} {
color: $color;

.#{$ns}-dark & {
color: map-get($pt-dark-intent-text-colors, $intent);
}
}
}
}
Expand Down
14 changes: 10 additions & 4 deletions packages/docs-app/src/examples/core-examples/iconExample.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,29 +6,33 @@

import * as React from "react";

import { H5, Icon, Label, Slider } from "@blueprintjs/core";
import { Example, IExampleProps } from "@blueprintjs/docs-theme";
import { H5, Icon, Intent, Label, Slider } from "@blueprintjs/core";
import { Example, handleStringChange, IExampleProps } from "@blueprintjs/docs-theme";
import { IconName } from "@blueprintjs/icons";
import { IconSelect } from "./common/iconSelect";
import { IntentSelect } from "./common/intentSelect";

export interface IIconExampleState {
icon: IconName;
iconSize: number;
intent: Intent;
}

export class IconExample extends React.PureComponent<IExampleProps, IIconExampleState> {
public state: IIconExampleState = {
icon: "calendar",
iconSize: Icon.SIZE_STANDARD,
intent: Intent.NONE,
};

public render() {
const { icon, iconSize } = this.state;
const { icon, iconSize, intent } = this.state;

const options = (
<>
<H5>Props</H5>
<IconSelect iconName={icon} onChange={this.handleIconNameChange} />
<IntentSelect intent={this.state.intent} onChange={this.handleIntentChange} />
<Label text="Icon size" />
<Slider
labelStepSize={MAX_ICON_SIZE / 5}
Expand All @@ -43,11 +47,13 @@ export class IconExample extends React.PureComponent<IExampleProps, IIconExample

return (
<Example options={options} {...this.props}>
<Icon icon={icon} iconSize={iconSize} />
<Icon icon={icon} iconSize={iconSize} intent={intent} />
</Example>
);
}

// tslint:disable-next-line:member-ordering
private handleIntentChange = handleStringChange((intent: Intent) => this.setState({ intent }));
private handleIconSizeChange = (iconSize: number) => this.setState({ iconSize });
private handleIconNameChange = (icon: IconName) => this.setState({ icon });
}
Expand Down