Skip to content

Commit

Permalink
fix: anchor
Browse files Browse the repository at this point in the history
  • Loading branch information
renrizzolo committed Nov 21, 2022
1 parent fc62201 commit 3944932
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 1 deletion.
9 changes: 9 additions & 0 deletions src/components/Anchor/Anchor.stories.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
export const Default = {
args: {
color: 'default',
children: 'Default',
// eslint-disable-next-line no-script-url
href: 'https://ui.adslot.com',
target: '_blank',
},
};
20 changes: 20 additions & 0 deletions src/components/Anchor/Anchor.stories.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { Meta, Story, Canvas, ArgsTable } from '@storybook/addon-docs';
import Anchor from './';
import { Horizontal } from '../../../www/storybook/Decorators';
import * as stories from './Anchor.stories.jsx';

<Meta title="Components/Anchor" component={Anchor} />

<Overview component={Anchor} stories={stories}>

Use anchors to link to web pages or documents.

Anchor shares the same props API as Button, with the addition of `href` and removal of `isLoading`.

See [Button](?path=/docs/button) for further usage.

<Canvas>
<Story name="Overview" story={stories.Default} />
</Canvas>

</Overview>
6 changes: 5 additions & 1 deletion src/components/Anchor/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import classNames from 'classnames';
import React from 'react';
import PropTypes from 'prop-types';
import { expandDts, invariant } from '../../lib/utils';
import { buttonSharedClasses, colors, variants, sizes } from '../Button';
import { buttonSharedClasses } from '../Button';

const Anchor = (props) => {
const {
Expand Down Expand Up @@ -62,6 +62,10 @@ const Anchor = (props) => {
);
};

const colors = ['default', 'primary', 'secondary', 'success', 'danger', 'warning', 'info'];
const variants = ['solid', 'borderless', 'inverse', 'link'];
const sizes = ['medium', 'large'];

Anchor.propTypes = {
color: PropTypes.oneOf(colors),
variant: PropTypes.oneOf(variants),
Expand Down

0 comments on commit 3944932

Please sign in to comment.