12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- // ./src/stories/Link.jsx
- import React from 'react';
- /**
- * A queue as described in a list.
- */
- const Link = ({text, url}) => {
- if (text === undefined || text === null) {
- text = url;
- }
- if (url !== undefined && url != null && url !== '') {
- text = <a href={url}>{text}</a>;
- }
- return (
- <>
- {text}
- <React.StrictMode/>
- </>
- )
- }
- export const createLink = ({
- text = '',
- url = '',
- }) => {
- if (text === undefined || text === null) {
- text = url;
- const link = document.createTextNode(url);
- }
- if (url !== undefined && url != null && url !== '') {
- text = <a href={url}>{text}</a>;
- const link = document.createElement('a')
- }
- const btn = document.createElement('button');
- btn.type = 'button';
- btn.innerText = label;
- btn.addEventListener('click', onClick);
- const mode = primary ? 'storybook-button--primary' : 'storybook-button--secondary';
- btn.className = ['storybook-button', `storybook-button--${size}`, mode].join(' ');
- btn.style.backgroundColor = backgroundColor;
- return btn;
- };
|