Skip to content

Commit

Permalink
external links
Browse files Browse the repository at this point in the history
  • Loading branch information
martinseanhunt committed Aug 8, 2022
1 parent 816efb4 commit 980a961
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 6 deletions.
2 changes: 1 addition & 1 deletion config.js
Expand Up @@ -57,7 +57,7 @@ const config = {
],
links: [
{ text: 'Cardano.org', link: 'https://cardano.org' },
{ text: 'Developer Portal', link: '(https://developers.cardano.org/' },
{ text: 'Developer Portal', link: 'https://developers.cardano.org/' },
],
frontLine: true, // This toggles collapse arrows
ignoreIndex: true,
Expand Down
15 changes: 15 additions & 0 deletions src/components/sidebar/treeNode.js
@@ -1,4 +1,6 @@
import React from 'react'
import { ExternalLink } from 'react-feather'

import OpenedSvg from '../images/opened'
import ClosedSvg from '../images/closed'
import config from '../../../config'
Expand Down Expand Up @@ -35,6 +37,17 @@ const TreeNode = ({

const calculatedClassName = `${className} item ${active ? 'active' : ''}`

// TODO: Some child entries are intented to simply link out to an external source.
// This is a quick and dirty way of making this happen which needs to be tidied up.

if (title === 'Testnet Explorer')
url = 'https://explorer.cardano-testnet.iohkdev.io/en'
if (title === 'Grafana Dashboard')
url =
'https://monitoring.cardano-testnet.iohkdev.io/grafana/d/Oe0reiHef/cardano-application-metrics-v2?orgId=1&refresh=1m&from=now-2d&to=now'

const isExternal = url && url.includes('http')

return (
<li className={calculatedClassName}>
{hasChildren
Expand All @@ -55,6 +68,8 @@ const TreeNode = ({
: title && (
<Link to={url}>
{title}
{isExternal && <ExternalLink size={14} />}

{!config.sidebar.frontLine && title && hasChildren ? (
<button
onClick={collapse}
Expand Down
2 changes: 2 additions & 0 deletions src/components/styles/GlobalStyles.js
Expand Up @@ -511,11 +511,13 @@ export const baseStyles = injectGlobal`
width: 100%;
padding-right: 35px;
padding-left: 15px;
justify-content: space-between;
}
.sideBarUL .sectionHeading + ul a {
font-weight: normal;
}
.showFrontLine .item a {
color: #1d1e21;
Expand Down
10 changes: 5 additions & 5 deletions src/components/styles/Sidebar.js
Expand Up @@ -13,7 +13,7 @@ export const Sidebar = styled('aside')`
position: sticky;
top: 0;
background: ${(props) => props.theme.colors.background};
background: ${props => props.theme.colors.background};
.rightSideTitle {
font-size: 10px;
Expand All @@ -25,7 +25,7 @@ export const Sidebar = styled('aside')`
border-left: 1px solid #e6ecf1;
border-left-color: rgb(230, 236, 241);
color: ${(props) => props.theme.colors.text};
color: ${props => props.theme.colors.text};
}
.rightSideBarUL {
Expand All @@ -44,7 +44,7 @@ export const Sidebar = styled('aside')`
line-height: 1.5;
padding: 7px 24px 7px 16px;
color: ${(props) => props.theme.colors.text};
color: ${props => props.theme.colors.text};
}
@media only screen and (max-width: 50rem) {
Expand All @@ -68,15 +68,15 @@ export const ListItem = styled(({ className, active, level, ...props }) => {
color: #5c6975;
text-decoration: none;
font-weight: ${({ level }) => (level === 0 ? 700 : 400)};
padding: 0.45rem 0 0.45rem ${(props) => 2 + (props.level || 0) * 1}rem;
padding: 0.45rem 0 0.45rem ${props => 2 + (props.level || 0) * 1}rem;
display: block;
position: relative;
&:hover {
color: rgba(82, 129, 247, 1) !important;
}
${(props) =>
${props =>
props.active &&
`
color: #1ED3C6;
Expand Down

0 comments on commit 980a961

Please sign in to comment.