terra-action-footer
Advanced tools
Comparing version 2.41.0 to 2.42.0
@@ -7,2 +7,7 @@ ChangeLog | ||
2.42.0 - (May 12, 2020) | ||
------------------ | ||
### Changed | ||
* Apply themes by context and directly include packaged themes. | ||
2.41.0 - (May 5, 2020) | ||
@@ -9,0 +14,0 @@ ------------------ |
@@ -12,4 +12,8 @@ "use strict"; | ||
var _classnames = _interopRequireDefault(require("classnames")); | ||
var _bind = _interopRequireDefault(require("classnames/bind")); | ||
var _terraThemeContext = _interopRequireDefault(require("terra-theme-context")); | ||
var _BlockActionFooterModule = _interopRequireDefault(require("./BlockActionFooter.module.scss")); | ||
@@ -38,6 +42,8 @@ | ||
var theme = _react.default.useContext(_terraThemeContext.default); | ||
var isEmpty = !_react.default.Children.toArray(children).length; | ||
var blockActionFooterClassNames = cx(['block-action-footer', { | ||
var blockActionFooterClassNames = (0, _classnames.default)(cx(['block-action-footer', { | ||
'with-actions': !isEmpty | ||
}, customProps.className]); | ||
}, theme.className]), customProps.className); | ||
return /*#__PURE__*/_react.default.createElement("div", _extends({}, customProps, { | ||
@@ -44,0 +50,0 @@ className: blockActionFooterClassNames |
{ | ||
"name": "terra-action-footer", | ||
"main": "lib/ActionFooter.js", | ||
"version": "2.41.0", | ||
"version": "2.42.0", | ||
"description": "The terra-action-footer component is a footer bar that contains sockets for placing actionable items such as buttons and hyperlinks. The default variation contains a start and end socket, while the centered variation has only a center socket. If no actions are provided, the footer bar collapses to a themeable height and maintains the top border.", | ||
@@ -33,3 +33,4 @@ "repository": { | ||
"terra-hyperlink": "^2.32.0", | ||
"terra-spacer": "^3.37.0" | ||
"terra-spacer": "^3.37.0", | ||
"terra-theme-context": "^1.0.0" | ||
}, | ||
@@ -49,3 +50,3 @@ "scripts": { | ||
}, | ||
"gitHead": "e48fecfbfb1f51fbad7c34f9aaf8c6b544e9a784" | ||
"gitHead": "cd1ff2a4eda29511aab8317b54aadca8a0d76b09" | ||
} |
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import classNames from 'classnames/bind'; | ||
import classNames from 'classnames'; | ||
import classNamesBind from 'classnames/bind'; | ||
import ThemeContext from 'terra-theme-context'; | ||
import styles from './BlockActionFooter.module.scss'; | ||
const cx = classNames.bind(styles); | ||
const cx = classNamesBind.bind(styles); | ||
@@ -20,9 +22,13 @@ const propTypes = { | ||
}) => { | ||
const theme = React.useContext(ThemeContext); | ||
const isEmpty = !React.Children.toArray(children).length; | ||
const blockActionFooterClassNames = cx([ | ||
'block-action-footer', | ||
{ 'with-actions': !isEmpty }, | ||
const blockActionFooterClassNames = classNames( | ||
cx([ | ||
'block-action-footer', | ||
{ 'with-actions': !isEmpty }, | ||
theme.className, | ||
]), | ||
customProps.className, | ||
]); | ||
); | ||
@@ -29,0 +35,0 @@ return ( |
@@ -162,2 +162,16 @@ import React from 'react'; | ||
}); | ||
it('correctly applies the theme context className', () => { | ||
jest.spyOn(React, 'useContext') | ||
.mockReturnValue({ | ||
className: 'orion-fusion-theme', | ||
}); | ||
const component = mount( | ||
<ActionFooter | ||
start={<button type="button">Start Button</button>} | ||
end={<button type="button">End Button</button>} | ||
/>, | ||
); | ||
expect(component).toMatchSnapshot(); | ||
}); | ||
}); |
@@ -69,2 +69,16 @@ import React from 'react'; | ||
}); | ||
it('correctly applies the theme context className', () => { | ||
jest.spyOn(React, 'useContext') | ||
.mockReturnValue({ | ||
className: 'orion-fusion-theme', | ||
}); | ||
const component = mount( | ||
<BlockActionFooter | ||
start={<button type="button">Start Button</button>} | ||
end={<button type="button">End Button</button>} | ||
/>, | ||
); | ||
expect(component).toMatchSnapshot(); | ||
}); | ||
}); |
@@ -77,2 +77,11 @@ import React from 'react'; | ||
}); | ||
it('correctly applies the theme context className', () => { | ||
jest.spyOn(React, 'useContext') | ||
.mockReturnValue({ | ||
className: 'orion-fusion-theme', | ||
}); | ||
const component = mount(<CenteredActionFooter center="Center Action" />); | ||
expect(component).toMatchSnapshot(); | ||
}); | ||
}); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
84809
81
1131
8
+ Addedterra-theme-context@^1.0.0