@dtdot/lego 2.0.0-10 → 2.0.0-11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -36,7 +36,7 @@ const ActionMenu = ({ children, variant, size, icon, text, 'data-cy': dataCy })
36
36
  return (React.createElement(React.Fragment, null,
37
37
  React.createElement(Button, { variant: variant, size: size, icon: icon || faEllipsisV, "data-cy": dataCy || 'action-menu-button', ref: setReferenceElement, onClick: () => setShown(true) }, text),
38
38
  shown &&
39
- ReactDOM.createPortal(React.createElement("div", { ref: setPopperElement, style: styles.popper, ...attributes.popper },
39
+ ReactDOM.createPortal(React.createElement("div", { ref: setPopperElement, style: { ...styles.popper, zIndex: 999 }, ...attributes.popper },
40
40
  React.createElement(ActionMenuContext.Provider, { value: { closeActionMenu: () => setShown(false) } },
41
41
  React.createElement(ActionMenuPanel, null, children))), document.querySelector('body'))));
42
42
  };
@@ -33,9 +33,11 @@ const IconOuter = styled.span `
33
33
  justify-content: center;
34
34
 
35
35
  color: ${(props) => getThemeVariantColours(props.variant, props.theme).contrastText};
36
- background-color: ${(props) => props.iconOnly
37
- ? getThemeVariantColours(props.variant, props.theme).main
38
- : getThemeVariantColours(props.variant, props.theme).darker};
36
+ background-color: ${(props) => props.noBackground
37
+ ? 'transparent'
38
+ : props.iconOnly
39
+ ? getThemeVariantColours(props.variant, props.theme).main
40
+ : getThemeVariantColours(props.variant, props.theme).darker};
39
41
 
40
42
  height: ${(props) => props.height || getIconContainerSizePx(props.size).height};
41
43
  width: ${(props) => getIconContainerSizePx(props.size).width};
@@ -51,8 +53,8 @@ const StyledButton = styled.button `
51
53
  font-size: ${(props) => props.theme.fonts.default.size};
52
54
  font-family: ${(props) => props.theme.fonts.default.family};
53
55
 
54
- color: ${(props) => getThemeVariantColours(props.variant, props.theme).contrastText};
55
- background-color: ${(props) => getThemeVariantColours(props.variant, props.theme).main};
56
+ color: ${(props) => getThemeVariantColours(props.noBackground ? 'secondary' : props.variant, props.theme).contrastText};
57
+ background-color: ${(props) => props.noBackground ? 'transparent' : getThemeVariantColours(props.variant, props.theme).main};
56
58
 
57
59
  border-radius: 2px;
58
60
 
@@ -63,7 +65,7 @@ const StyledButton = styled.button `
63
65
  margin-top: ${(props) => props.marginTop};
64
66
 
65
67
  &:hover {
66
- background-color: ${(props) => getThemeVariantColours(props.variant, props.theme).hover};
68
+ background-color: ${(props) => props.noBackground ? 'transparent' : getThemeVariantColours(props.variant, props.theme).hover};
67
69
 
68
70
  ${IconOuter} {
69
71
  background-color: ${(props) => props.iconOnly
@@ -109,11 +111,11 @@ const ButtonSpinner = styled.div `
109
111
  `;
110
112
  const Button = React.forwardRef(function Button(props, ref) {
111
113
  const { children, loading, variant = 'primary', size = 'md', type = 'button', icon, onClick, 'data-cy': dataCy, } = props;
112
- const { width, height, alignSelf, marginTop } = useContext(ButtonContext);
113
- return (React.createElement(StyledButton, { ref: ref, width: width, height: height, alignSelf: alignSelf, marginTop: marginTop, variant: variant, size: size, type: type, onClick: onClick, "data-cy": dataCy || 'button', iconOnly: !children }, loading ? (React.createElement(SpinnerContainer, null,
114
+ const { width, height, alignSelf, marginTop, noBackground } = useContext(ButtonContext);
115
+ return (React.createElement(StyledButton, { ref: ref, width: width, height: height, alignSelf: alignSelf, marginTop: marginTop, noBackground: noBackground, variant: variant, size: size, type: type, onClick: onClick, "data-cy": dataCy || 'button', iconOnly: !children }, loading ? (React.createElement(SpinnerContainer, null,
114
116
  React.createElement(ButtonSpinner, { "data-cy": 'button-loading-spinner', variant: variant, size: size, iconOnly: !children }))) : (React.createElement(ButtonInner, null,
115
117
  children && React.createElement(ButtonTextContainer, { size: size }, children),
116
- icon && (React.createElement(IconOuter, { variant: variant, size: size, height: height, iconOnly: !children },
118
+ icon && (React.createElement(IconOuter, { noBackground: noBackground, variant: variant, size: size, height: height, iconOnly: !children },
117
119
  React.createElement(FontAwesomeIcon, { icon: icon })))))));
118
120
  });
119
121
  export default Button;
@@ -4,6 +4,7 @@ export interface ButtonContextProps {
4
4
  height?: string;
5
5
  alignSelf?: string;
6
6
  marginTop?: string;
7
+ noBackground?: boolean;
7
8
  }
8
9
  declare const ButtonContext: import("react").Context<ButtonContextProps>;
9
10
  export default ButtonContext;
@@ -4,5 +4,6 @@ const ButtonContext = createContext({
4
4
  height: undefined,
5
5
  alignSelf: undefined,
6
6
  marginTop: undefined,
7
+ noBackground: undefined,
7
8
  });
8
9
  export default ButtonContext;
@@ -1,13 +1,14 @@
1
1
  import React from 'react';
2
2
  import styled from 'styled-components';
3
3
  import { Text } from '../..';
4
+ import ButtonContext from '../Button/Button.context';
4
5
  const HeaderRow = styled.div `
5
6
  display: flex;
6
7
  justify-content: space-between;
7
8
  padding: 8px 16px;
8
9
  margin-bottom: 8px;
9
10
 
10
- border-bottom: thin solid ${(props) => props.theme.colours.defaultBorder};
11
+ background-color: ${(props) => props.theme.colours.cardBackgroundSecondary};
11
12
  `;
12
13
  const LeftContainer = styled.div `
13
14
  display: flex;
@@ -43,6 +44,7 @@ const CardHeader = ({ image, heading, subHeading, meta }) => {
43
44
  React.createElement(Text, null, heading)),
44
45
  React.createElement("div", null,
45
46
  React.createElement(Text, { variant: 'secondary' }, subHeading)))),
46
- meta && React.createElement(MetaContainer, null, meta)));
47
+ meta && (React.createElement(MetaContainer, null,
48
+ React.createElement(ButtonContext.Provider, { value: { height: '24px', width: '24px', noBackground: true } }, meta)))));
47
49
  };
48
50
  export default CardHeader;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dtdot/lego",
3
- "version": "2.0.0-10",
3
+ "version": "2.0.0-11",
4
4
  "description": "Some reusable components for building my applications",
5
5
  "main": "build/index.js",
6
6
  "scripts": {