From 6e0d622a1559937d8867216d571156564c666c77 Mon Sep 17 00:00:00 2001 From: Steve Klebanoff Date: Mon, 17 Dec 2018 14:17:36 -0800 Subject: Open all new instant links in new window --- packages/website/ts/@next/components/button.tsx | 6 ++++-- packages/website/ts/@next/components/definition.tsx | 1 + packages/website/ts/@next/components/link.tsx | 21 ++++++++++++++------- .../website/ts/@next/pages/instant/configurator.tsx | 13 +++++-------- 4 files changed, 24 insertions(+), 17 deletions(-) (limited to 'packages') diff --git a/packages/website/ts/@next/components/button.tsx b/packages/website/ts/@next/components/button.tsx index 4c8c0361e..b686b27a2 100644 --- a/packages/website/ts/@next/components/button.tsx +++ b/packages/website/ts/@next/components/button.tsx @@ -19,6 +19,7 @@ interface ButtonInterface { isInline?: boolean; href?: string; type?: string; + target?: string; to?: string; onClick?: () => any; theme?: ThemeInterface; @@ -26,7 +27,7 @@ interface ButtonInterface { } export const Button = (props: ButtonInterface) => { - const { children, href, isWithArrow, to, useAnchorTag } = props; + const { children, href, isWithArrow, to, useAnchorTag, target } = props; let linkElem; if (href || useAnchorTag) { @@ -37,9 +38,10 @@ export const Button = (props: ButtonInterface) => { } const Component = linkElem ? ButtonBase.withComponent(linkElem) : ButtonBase; + const targetProp = href && target ? { target } : {}; return ( - + {children} {isWithArrow && ( diff --git a/packages/website/ts/@next/components/definition.tsx b/packages/website/ts/@next/components/definition.tsx index be0973bdd..d203151b9 100644 --- a/packages/website/ts/@next/components/definition.tsx +++ b/packages/website/ts/@next/components/definition.tsx @@ -55,6 +55,7 @@ export const Definition = (props: Props) => ( isWithArrow={true} isAccentColor={true} useAnchorTag={item.useAnchorTag} + target="_blank" > {item.label} diff --git a/packages/website/ts/@next/components/link.tsx b/packages/website/ts/@next/components/link.tsx index c3633987a..0976a57a8 100644 --- a/packages/website/ts/@next/components/link.tsx +++ b/packages/website/ts/@next/components/link.tsx @@ -13,19 +13,23 @@ interface LinkInterface { theme?: { textColor: string; }; + target?: string; } export const Link = (props: LinkInterface) => { - const { - children, - isNoArrow, - href, - } = props; + const { children, isNoArrow, href, target } = props; return ( {children} - {!isNoArrow && } + {!isNoArrow && ( + + + + )} ); }; @@ -39,7 +43,10 @@ export const LinkWrap = styled.div` } `; -const StyledLink = styled(ReactRouterLink)` +const StyledLink = + styled(ReactRouterLink) < + LinkInterface > + ` display: ${props => !props.isBlock && 'inline-flex'}; color: ${props => props.color || props.theme.linkColor}; text-align: center; diff --git a/packages/website/ts/@next/pages/instant/configurator.tsx b/packages/website/ts/@next/pages/instant/configurator.tsx index 007526396..7c67e6333 100644 --- a/packages/website/ts/@next/pages/instant/configurator.tsx +++ b/packages/website/ts/@next/pages/instant/configurator.tsx @@ -30,19 +30,16 @@ export class Configurator extends React.Component { public render(): React.ReactNode { const codeToDisplay = this._generateCodeDemoCode(); return ( - + - Code Snippet - + + Code Snippet + + Explore the Docs -- cgit v1.2.3