Skip to content

Commit

Permalink
refactor icons.json (#2084)
Browse files Browse the repository at this point in the history
* icons.json name=>displayName, className=>iconName

* drop pt-icon- from SVG filenames

also chmod -x all these files (why were they executable in the first place??)

* docs
  • Loading branch information
giladgray authored Feb 6, 2018
1 parent e52f20f commit a057afa
Show file tree
Hide file tree
Showing 870 changed files with 898 additions and 899 deletions.
24 changes: 12 additions & 12 deletions packages/docs-app/src/components/docsIcon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,51 +11,51 @@ import { ContextMenuTarget, Icon, IconName, Menu, MenuItem } from "@blueprintjs/
import { ClickToCopy } from "./clickToCopy";

export interface IDocsIconProps {
displayName: string;
group: string;
name: string;
iconName: IconName;
tags: string;
className: IconName;
}

const GITHUB_PATH = "https://github.com/palantir/blueprint/blob/develop/resources/icons";

@ContextMenuTarget
export class DocsIcon extends React.PureComponent<IDocsIconProps, {}> {
public render() {
const { className, name, tags } = this.props;
const { iconName, displayName, tags } = this.props;
return (
<ClickToCopy className="docs-icon" data-tags={tags} value={className}>
<Icon iconName={className} iconSize={Icon.SIZE_LARGE} />
<ClickToCopy className="docs-icon" data-tags={tags} value={iconName}>
<Icon iconName={iconName} iconSize={Icon.SIZE_LARGE} />
<span className="docs-icon-detail">
<div className="docs-icon-name">{name}</div>
<div className="docs-icon-class-name pt-monospace-text">{className}</div>
<div className="docs-icon-name">{displayName}</div>
<div className="docs-icon-class-name pt-monospace-text">{iconName}</div>
<div className="docs-clipboard-message pt-text-muted" data-hover-message="Click to copy" />
</span>
</ClickToCopy>
);
}

public renderContextMenu() {
const { className } = this.props;
const { iconName } = this.props;
return (
<Menu>
<MenuItem
className="docs-icon-16"
iconName={className}
iconName={iconName}
text="Download 16px SVG"
onClick={this.handleClick16}
/>
<MenuItem
className="docs-icon-20"
iconName={className}
iconName={iconName}
text="Download 20px SVG"
onClick={this.handleClick20}
/>
</Menu>
);
}

private handleClick16 = () => window.open(`${GITHUB_PATH}/16px/${this.props.className}.svg`);
private handleClick16 = () => window.open(`${GITHUB_PATH}/16px/${this.props.iconName}.svg`);

private handleClick20 = () => window.open(`${GITHUB_PATH}/20px/${this.props.className}.svg`);
private handleClick20 = () => window.open(`${GITHUB_PATH}/20px/${this.props.iconName}.svg`);
}
5 changes: 1 addition & 4 deletions packages/docs-app/src/components/icons.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,6 @@ export class Icons extends React.PureComponent<IIconsProps, IIconsState> {
groups[icon.group].push(icon);
return groups;
}, {});
for (const group of Object.keys(this.iconGroups)) {
this.iconGroups[group].sort((a, b) => a.name.localeCompare(b.name));
}
}

public render() {
Expand Down Expand Up @@ -108,7 +105,7 @@ export class Icons extends React.PureComponent<IIconsProps, IIconsState> {
}

function isIconFiltered(query: string, icon: IIcon) {
return smartSearch(query, icon.name, icon.className, icon.tags, icon.group);
return smartSearch(query, icon.displayName, icon.iconName, icon.tags, icon.group);
}

function renderIcon(icon: IIcon, index: number) {
Expand Down
Loading

1 comment on commit a057afa

@blueprint-bot
Copy link

Choose a reason for hiding this comment

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

refactor icons.json (#2084)

Preview: documentation | landing | table

Please sign in to comment.