Feat/16507/button link housekeeping (#16518)

feature/default_network_editable
Garrett Bear 2 years ago committed by GitHub
parent 8f18e04b97
commit e11203c2cd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      ui/components/component-library/button-link/README.mdx
  2. 16
      ui/components/component-library/button-link/__snapshots__/button-link.test.js.snap
  3. 6
      ui/components/component-library/button-link/button-link.js
  4. 1
      ui/components/component-library/button-link/button-link.scss
  5. 2
      ui/components/component-library/button-link/button-link.stories.js
  6. 1
      ui/components/component-library/button-link/button-link.test.js
  7. 1
      ui/components/component-library/button-link/index.js
  8. 2
      ui/components/component-library/button-primary/button-primary.js
  9. 2
      ui/components/component-library/button-secondary/button-secondary.js
  10. 2
      ui/components/component-library/button/__snapshots__/button.test.js.snap
  11. 2
      ui/components/component-library/text/text.js

@ -45,7 +45,7 @@ import { ButtonLink } from '../../ui/components/component-library';
### Danger ### Danger
Use the `danger` boolean prop to change the `ButtonPrimary` to danger color. Use the `danger` boolean prop to change the `ButtonLink` to danger color.
<Canvas> <Canvas>
<Story id="ui-components-component-library-button-link-button-link-stories-js--danger" /> <Story id="ui-components-component-library-button-link-button-link-stories-js--danger" />

@ -0,0 +1,16 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`ButtonLink should render button element correctly 1`] = `
<div>
<button
class="box mm-button mm-button--size-md mm-button-link box--padding-right-4 box--padding-left-4 box--display-inline-flex box--flex-direction-row box--justify-content-center box--align-items-center box--background-color-transparent"
data-testid="button-link"
>
<span
class="box text mm-button__content text--body-md text--color-inherit box--gap-2 box--flex-direction-row box--justify-content-center box--align-items-center box--display-flex"
>
Button Link
</span>
</button>
</div>
`;

@ -3,6 +3,7 @@ import PropTypes from 'prop-types';
import classnames from 'classnames'; import classnames from 'classnames';
import { ButtonBase } from '../button-base'; import { ButtonBase } from '../button-base';
import { COLORS } from '../../../helpers/constants/design-system';
import { BUTTON_LINK_SIZES } from './button-link.constants'; import { BUTTON_LINK_SIZES } from './button-link.constants';
export const ButtonLink = ({ export const ButtonLink = ({
@ -17,6 +18,7 @@ export const ButtonLink = ({
'mm-button-link--type-danger': danger, 'mm-button-link--type-danger': danger,
})} })}
size={size} size={size}
backgroundColor={COLORS.TRANSPARENT}
{...props} {...props}
/> />
); );
@ -32,7 +34,7 @@ ButtonLink.propTypes = {
*/ */
danger: PropTypes.bool, danger: PropTypes.bool,
/** /**
* The possible size values for ButtonLink: 'SIZES.AUTO', 'SIZES.SM', 'SIZES.MD', 'SIZES.LG', * Possible size values: 'SIZES.AUTO', 'SIZES.SM'(32px), 'SIZES.MD'(40px), 'SIZES.LG'(48px).
* Default value is 'SIZES.MD'. * Default value is 'SIZES.MD'.
*/ */
size: PropTypes.oneOf(Object.values(BUTTON_LINK_SIZES)), size: PropTypes.oneOf(Object.values(BUTTON_LINK_SIZES)),
@ -41,5 +43,3 @@ ButtonLink.propTypes = {
*/ */
...ButtonBase.propTypes, ...ButtonBase.propTypes,
}; };
export default ButtonLink;

@ -1,6 +1,5 @@
.mm-button-link { .mm-button-link {
color: var(--color-primary-default); color: var(--color-primary-default);
background-color: transparent;
&:hover { &:hover {
color: var(--color-primary-default); color: var(--color-primary-default);

@ -130,7 +130,7 @@ export const Size = (args) => (
Large Button Large Button
</ButtonLink> </ButtonLink>
</Box> </Box>
<Text variant={TEXT.BODY_SM}> <Text variant={TEXT.BODY_MD}>
<ButtonLink {...args} size={SIZES.AUTO}> <ButtonLink {...args} size={SIZES.AUTO}>
Button Auto Button Auto
</ButtonLink>{' '} </ButtonLink>{' '}

@ -12,6 +12,7 @@ describe('ButtonLink', () => {
expect(getByText('Button Link')).toBeDefined(); expect(getByText('Button Link')).toBeDefined();
expect(container.querySelector('button')).toBeDefined(); expect(container.querySelector('button')).toBeDefined();
expect(getByTestId('button-link')).toHaveClass('mm-button'); expect(getByTestId('button-link')).toHaveClass('mm-button');
expect(container).toMatchSnapshot();
}); });
it('should render anchor element correctly', () => { it('should render anchor element correctly', () => {

@ -1 +1,2 @@
export { ButtonLink } from './button-link'; export { ButtonLink } from './button-link';
export { BUTTON_LINK_SIZES } from './button-link.constants';

@ -41,5 +41,3 @@ ButtonPrimary.propTypes = {
*/ */
...ButtonBase.propTypes, ...ButtonBase.propTypes,
}; };
export default ButtonPrimary;

@ -41,5 +41,3 @@ ButtonSecondary.propTypes = {
*/ */
...ButtonBase.propTypes, ...ButtonBase.propTypes,
}; };
export default ButtonSecondary;

@ -38,7 +38,7 @@ exports[`Button should render with different button types 1`] = `
</span> </span>
</button> </button>
<button <button
class="box mm-button mm-button--size-md mm-button-link box--padding-right-4 box--padding-left-4 box--display-inline-flex box--flex-direction-row box--justify-content-center box--align-items-center" class="box mm-button mm-button--size-md mm-button-link box--padding-right-4 box--padding-left-4 box--display-inline-flex box--flex-direction-row box--justify-content-center box--align-items-center box--background-color-transparent"
data-testid="link" data-testid="link"
> >
<span <span

@ -154,5 +154,3 @@ Text.propTypes = {
}; };
Text.displayName = 'Text'; // Used for React DevTools profiler Text.displayName = 'Text'; // Used for React DevTools profiler
export default Text;

Loading…
Cancel
Save