Skip to content

Commit

Permalink
Added stories / changed to CSS Modules / changed em to px
Browse files Browse the repository at this point in the history
  • Loading branch information
Arashayo committed Dec 2, 2023
1 parent e1397c5 commit 195505a
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 10 deletions.
6 changes: 3 additions & 3 deletions ui/src/components/TextLink/TextLink.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react'
import './TextLink.scss'
import classes from './TextLink.module.scss'
import { FiExternalLink } from 'react-icons/fi'
import PropTypes from 'prop-types'

Expand All @@ -14,10 +14,10 @@ const TextLink = ({ url, text, external }) => {
target={external ? '_blank' : '_self'}
rel={external ? 'noopener noreferrer' : ''}
onClick={handleClick}
className={`text-link ${external ? 'external' : ''}`}
className={`${classes.textLink} ${external ? 'external' : ''}`}
>
{text}
{external && <FiExternalLink className='external-icon'/>}
{external && <FiExternalLink className={classes.externalIcon}/>}
</a>
)
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
@import '../../assets/styles/abstracts/variables';

.text-link {
.textLink {
text-decoration: underline;
color: $alternative-a500;
padding: 10px 4px 0px 4px;
padding: 0.625em 0.25em 0em 0.25em;
border-radius: 2px;
transition: background-color 0.3s;

Expand All @@ -13,15 +13,14 @@

&:focus {
outline: none;
background-color: $primary-p100
;
background-color: $primary-p100;
}

}

.external-icon {
top: -0.2em;
margin-left: 0.3em;
.externalIcon {
top: -3.2px;
margin-left: 4.8px;
vertical-align: text-bottom;
position: relative;
}
28 changes: 28 additions & 0 deletions ui/src/components/TextLink/TextLink.stories.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import React from 'react';
import TextLink from './TextLink';

export default {
title: 'Components/TextLink',
component: TextLink,
argTypes: {
external: {
control: 'boolean',
},
},
};

const Template = (args) => <TextLink {...args} />;

export const InternalLink = Template.bind({});
InternalLink.args = {
url: '/page',
text: 'Internal Link',
external: false,
};

export const ExternalLink = Template.bind({});
ExternalLink.args = {
url: 'https://www.put.poznan.pl',
text: 'External Link',
external: true,
};

0 comments on commit 195505a

Please sign in to comment.