Skip to content

Commit

Permalink
feat/homepage links can navigate out (#16)
Browse files Browse the repository at this point in the history
  • Loading branch information
CarmitKl authored Mar 1, 2022
1 parent 3346da5 commit 4b9ac7e
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 3 deletions.
2 changes: 1 addition & 1 deletion docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const config = {
baseUrl: '/starknet-docs/',
onBrokenLinks: 'throw',
onBrokenMarkdownLinks: 'warn',
favicon: 'img/favicon.ico',
favicon: 'img/favicon.svg',
organizationName: 'starkware-libs', // Usually your GitHub org/user name.
projectName: 'starknet-docs', // Usually your repo name.
deploymentBranch: 'deployed',
Expand Down
10 changes: 9 additions & 1 deletion src/components/HomepageFeatures/HomepageFeatures.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,15 @@ export const HomepageFeatures = () => {
const history = useHistory();

const renderCards = () => {
const handleOnClick = linkName => history.push(linkName);
const handleOnClick = linkName => {
if (!linkName) return;
if (linkName.startsWith('http')) {
window.open(linkName, '_blank');
} else {
history.push(linkName);
}
};

const handleOnKeyDown = (event, linkName) => {
if (event.key === 'Enter') {
history.push(linkName);
Expand Down
2 changes: 1 addition & 1 deletion src/config/home.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"text": "tools for development and deployment"
},
{
"linkName": "docs/CLI/commands",
"linkName": "https://community.starknet.io/",
"img": "undraw_docusaurus_mountain.svg",
"title": "discussions",
"text": "starknet community discussions"
Expand Down
Binary file removed static/img/favicon.ico
Binary file not shown.
8 changes: 8 additions & 0 deletions static/img/favicon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 4b9ac7e

Please sign in to comment.