Skip to content

Commit

Permalink
Open url in same tab (#157)
Browse files Browse the repository at this point in the history
  • Loading branch information
cipick authored Apr 17, 2020
1 parent 9850b3c commit f10b6ff
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@code4ro/taskforce-fe-components",
"version": "1.0.12",
"version": "1.0.13",
"private": false,
"dependencies": {
"bulma": "^0.8.0",
Expand Down
11 changes: 8 additions & 3 deletions src/components/logo/logo.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ import React from "react";
import PropTypes from "prop-types";
import "./logo.scss";

export const Logo = ({ children, url, imgClass }) => {
export const Logo = ({ children, url, target, imgClass }) => {
return (
<div className="logo">
{url ? (
<a href={url} target="_blank" rel="noopener noreferrer">
<a href={url} target={target} rel="noopener noreferrer">
<span className={imgClass}>{children}</span>
</a>
) : (
Expand All @@ -19,5 +19,10 @@ export const Logo = ({ children, url, imgClass }) => {
Logo.propTypes = {
children: PropTypes.node.isRequired,
url: PropTypes.string,
imgClass: PropTypes.string
imgClass: PropTypes.string,
target: PropTypes.oneOf(["_blank", "_self", "_parent", "_top"])
};

Logo.defaultProps = {
target: "_blank"
};
5 changes: 5 additions & 0 deletions src/components/logo/logo.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ export const regular = () => (
<Code4Logo />
</Logo>
);
export const openUrlInSameTab = () => (
<Logo url="https://code4.ro" target="_self">
<Code4Logo />
</Logo>
);
export const withUrl = () => (
<Logo url="https://code4.ro">
<Code4Logo />
Expand Down

1 comment on commit f10b6ff

@vercel
Copy link

@vercel vercel bot commented on f10b6ff Apr 17, 2020

Choose a reason for hiding this comment

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

Please sign in to comment.