Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DEP Upgrade bootstrap and reactstrap #1889

Draft
wants to merge 1 commit into
base: 3.0
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion client/dist/js/bundle.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion client/dist/js/vendor.js

Large diffs are not rendered by default.

7 changes: 3 additions & 4 deletions client/dist/styles/bundle.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion client/src/components/Accordion/AccordionBlock.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const AccordionBlock = (props) => {
<div className="accordion__block">
<a
className="accordion__title"
data-toggle="collapse"
data-bs-toggle="collapse"
href={`#${listIDAttr}`}
aria-expanded="true"
aria-controls={listID}
Expand Down
3 changes: 2 additions & 1 deletion client/src/components/Badge/Badge.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ class Badge extends PureComponent {
className,
'badge',
`badge-${status}`,
`bg-${status}`,
invertedClass,
);
return (
Expand All @@ -48,7 +49,7 @@ Badge.propTypes = {

Badge.defaultProps = {
status: 'default',
className: 'badge-pill',
className: 'rounded-pill',
inverted: false,
};

Expand Down
7 changes: 4 additions & 3 deletions client/src/components/Badge/mixins/_badge.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@
// See: bootstrap/mixins/_badge.scss for original.
@mixin badge-variant-inverted($bg) {
color: $bg;
background-color: color-yiq($bg);
background-color: color-contrast($bg);

&[href] {
@include hover-focus {
&:hover,
&:focus {
color: darken($bg, 10%);
background-color: color-yiq($bg);
background-color: color-contrast($bg);
}
}
}
6 changes: 3 additions & 3 deletions client/src/components/Badge/tests/Badge-story.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,11 @@ export default {
control: 'inline-radio',
options: {
'Empty class name': '',
'badge-pill class name': 'badge-pill'
'rounded-pill class name': 'rounded-pill'
},
table: {
type: { summary: 'string' },
defaultValue: { summary: 'badge-pill' },
defaultValue: { summary: 'rounded-pill' },
},
}
}
Expand All @@ -60,7 +60,7 @@ export const _Badge = {
args: {
message: 'Hello World!',
status: 'default',
className: 'badge-pill',
className: 'rounded-pill',
inverted: false
}
};
2 changes: 1 addition & 1 deletion client/src/components/Badge/tests/Badge-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ test('Badge render() should return a Bootstrap style badge when valid', () => {
/>
);
expect(container.querySelectorAll('.badge').length).toBe(1);
expect(container.querySelectorAll('.badge-success').length).toBe(1);
expect(container.querySelectorAll('.bg-success').length).toBe(1);
expect(container.querySelectorAll('.customclass').length).toBe(1);
expect(container.innerHTML).toContain('Hello world');
});
2 changes: 1 addition & 1 deletion client/src/components/Breadcrumb/Breadcrumb.scss
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
max-height: $toolbar-height;
overflow: hidden;

@include media-breakpoint-down(sm) {
@include media-breakpoint-down(md) {
margin-left: $toolbar-total-height;

.toolbar__back-button + & {
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/Button/BackButton.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
color: $text-muted; // TEMP: Needed for anchor buttons to override legacy styles
margin-left: -$spacer-xs;

@include media-breakpoint-down(sm) {
@include media-breakpoint-down(md) {
margin-left: 42px;

.insert-media-modal & {
Expand Down
20 changes: 11 additions & 9 deletions client/src/components/FieldHolder/FieldHolder.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { Component } from 'react';
import { FormGroup, InputGroup, InputGroupAddon, Label } from 'reactstrap';
import { FormGroup, InputGroup, InputGroupText, Label } from 'reactstrap';
import castStringToElement from 'lib/castStringToElement';
import classnames from 'classnames';
import PropTypes from 'prop-types';
Expand Down Expand Up @@ -126,20 +126,22 @@ function fieldHolder(Field) {
};

const field = <Field {...props} />;
const prefix = this.props.data && this.props.data.prefix ? this.props.data.prefix : '';
const suffix = this.props.data && this.props.data.suffix ? this.props.data.suffix : '';
let prefix = this.props.data && this.props.data.prefix ? this.props.data.prefix : '';
let suffix = this.props.data && this.props.data.suffix ? this.props.data.suffix : '';
if (!prefix && !suffix) {
return field;
}
if (prefix !== '' && typeof prefix === 'string') {
prefix = <InputGroupText>{prefix}</InputGroupText>;
}
if (suffix !== '' && typeof suffix === 'string') {
suffix = <InputGroupText>{suffix}</InputGroupText>;
}
return (
<InputGroup>
{prefix &&
<InputGroupAddon addonType="prepend">{prefix}</InputGroupAddon>
}
{prefix}
{field}
{suffix &&
<InputGroupAddon addonType="append">{suffix}</InputGroupAddon>
}
{suffix}
</InputGroup>
);
}
Expand Down
6 changes: 4 additions & 2 deletions client/src/components/FieldHolder/tests/FieldHolder-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,8 @@ test('FieldHolder prefix', () => {
}}
/>
);
expect(container.querySelector('.input-group-prepend .input-group-text').innerHTML).toBe('My prefix');
expect(container.querySelectorAll('.input-group-text')).toHaveLength(1);
expect(container.querySelector('.input-group .input-group-text').innerHTML).toBe('My prefix');
});

test('FieldHolder prefix', () => {
Expand All @@ -210,7 +211,8 @@ test('FieldHolder prefix', () => {
}}
/>
);
expect(container.querySelector('.input-group-append .input-group-text').innerHTML).toBe('My suffix');
expect(container.querySelectorAll('.input-group-text')).toHaveLength(1);
expect(container.querySelector('.input-group .input-group-text').innerHTML).toBe('My suffix');
});

test('FieldHolder titleTip should be rendered if one is provided', () => {
Expand Down
3 changes: 1 addition & 2 deletions client/src/components/FormAction/FormAction.scss
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@
}

// Used buttons with text and icons, but you wan to hide the text only. eg. gridfield pagination
// Could change to BS .text-hide { @include text-hide(); }, although slightly different
.btn--hide-text[class*="font-icon-"] {

&:before {
Expand Down Expand Up @@ -312,7 +311,7 @@ button.close {
}

.actions-warning {
color: #856404; // in bootstrap: theme-color-level(map-get($theme-colors, "yellow"), 6)
color: #856404; // in bootstrap: shift-color(map-get($theme-colors, "yellow"), 6)

// override .btn styles
&.btn {
Expand Down
4 changes: 2 additions & 2 deletions client/src/components/GridField/GridField.scss
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ div.grid-field__sort-field + .form__fieldgroup-item {
.grid-field__icon-action--hidden-on-hover {
opacity: 0;

@include media-breakpoint-down(sm) {
@include media-breakpoint-down(md) {
opacity: 1;
}
}
Expand Down Expand Up @@ -243,7 +243,7 @@ div.grid-field__sort-field + .form__fieldgroup-item {


// Responsive grid-field
@include media-breakpoint-down(sm) {
@include media-breakpoint-down(md) {
.grid-field__table td,
.grid-field__table th {
display: none;
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/GridFieldActions/GridFieldActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class GridFieldActions extends PureComponent {
return groupsList;
}, []);

const dropdownMenuProps = { right: true };
const dropdownMenuProps = { end: true };
const dropdownToggleClassNames = [
'action-menu__toggle',
'btn',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ test('GridFieldActions.render() should render a menu, if there is more than one
}}
/>
);
expect(container.querySelector('.action-menu__toggle .sr-only').innerHTML).toBe('View actions');
expect(container.querySelector('.action-menu__toggle .visually-hidden').innerHTML).toBe('View actions');
});

test('GridFieldActions.renderSingleAction() should render a button', () => {
Expand Down
13 changes: 5 additions & 8 deletions client/src/components/InputField/InputField.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import React, { Component } from 'react';
import {
Input,
InputGroup,
InputGroupAddon,
} from 'reactstrap';
import PropTypes from 'prop-types';

Expand Down Expand Up @@ -69,13 +68,11 @@ class InputField extends Component {
return (
<InputGroup>
<Input {...this.getInputProps()} />
<InputGroupAddon addonType="append">
<Tip
{...tip}
fieldTitle={title}
id={`${id}-tip`}
/>
</InputGroupAddon>
<Tip
{...tip}
fieldTitle={title}
id={`${id}-tip`}
/>
</InputGroup>
);
}
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/LabelField/LabelField.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import PropTypes from 'prop-types';

const LabelField = ({ id, className, title, extraClass, data }) => {
const htmlFor = data && data.target;
const classes = `${className} ${extraClass}`;
const classes = `form-label ${className} ${extraClass}`;

return (
<label id={id} className={classes} htmlFor={htmlFor}>{title}</label>
Expand Down
22 changes: 11 additions & 11 deletions client/src/components/Menu/Menu.scss
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
width: $cms-menu-width !important;
overflow: hidden;

@include media-breakpoint-down(sm) {
@include media-breakpoint-down(md) {
position: absolute;
top: 0;
left: -100%;
Expand Down Expand Up @@ -130,7 +130,7 @@
padding-right: 1px;
border-top: 1px solid rgba($border-color, .5);

@include media-breakpoint-down(sm) {
@include media-breakpoint-down(md) {
.toggle-collapse,
.toggle-expand,
.sticky-toggle {
Expand Down Expand Up @@ -220,7 +220,7 @@
}

.cms-menu.cms-menu--open + .cms-menu-mobile-overlay {
@include media-breakpoint-down(sm) {
@include media-breakpoint-down(md) {
display: block;
}
}
Expand Down Expand Up @@ -258,7 +258,7 @@
background-color: $brand-secondary-hover;
}

@include media-breakpoint-down(sm) {
@include media-breakpoint-down(md) {
text-align: center;
}

Expand All @@ -277,7 +277,7 @@
opacity: .9;
}

@include media-breakpoint-down(sm) {
@include media-breakpoint-down(md) {
margin-left: $toolbar-total-height;
margin-right: $toolbar-total-height;
}
Expand Down Expand Up @@ -336,7 +336,7 @@
padding-left: 0;
transition: padding $transition-speed-fast;

@include media-breakpoint-down(sm) {
@include media-breakpoint-down(md) {
left: 18px;
}
}
Expand All @@ -348,7 +348,7 @@
white-space: nowrap;
padding-left: 29px;

@include media-breakpoint-down(sm) {
@include media-breakpoint-down(md) {
padding-left: 36px;
}
}
Expand All @@ -373,7 +373,7 @@
}
}

@include media-breakpoint-down(sm) {
@include media-breakpoint-down(md) {
left: 20px;
}
}
Expand Down Expand Up @@ -441,7 +441,7 @@
display: block;
margin-left: 30px;

@include media-breakpoint-down(sm) {
@include media-breakpoint-down(md) {
margin-left: 38px;
}
}
Expand Down Expand Up @@ -486,7 +486,7 @@
top: 0;
z-index: $zindex-menu + 1;

@include media-breakpoint-down(sm) {
@include media-breakpoint-down(md) {
display: block;
}
}
Expand Down Expand Up @@ -593,7 +593,7 @@
}
}

@include media-breakpoint-between(sm, sm) {
@include media-breakpoint-between(sm, md) {
.cms-help {
&__links a.cms-help__link {
display: none;
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/Modal/Modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ const Modal = ({
typeof onClosed === 'function' && (
<button
type="button"
className="close modal__close-button"
className="btn-close modal__close-button"
onClick={onClosed}
aria-label={i18n._t('Admin.CLOSE', 'Close')}
/>
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/Modal/Modal.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// IE10 fix
height: calc(100% - #{$toolbar-total-height});

@include media-breakpoint-down(sm) {
@include media-breakpoint-down(md) {
height: calc(100% - 1rem);
width: calc(100% - .5rem);
margin: 0 auto;
Expand Down
18 changes: 8 additions & 10 deletions client/src/components/PopoverOptionSet/PopoverOptionSet.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { Button, Input, InputGroup, InputGroupAddon, Popover, Util as reactstrapUtil } from 'reactstrap';
import { Button, Input, InputGroup, Popover, Util as reactstrapUtil } from 'reactstrap';
import classNames from 'classnames';
import i18n from 'i18n';

Expand Down Expand Up @@ -91,7 +91,7 @@ class PopoverOptionSet extends Component {

/**
* Render a link to clear the search field if user entered input
* @returns {InputGroupAddon|null}
* @returns {button|null}
*/
renderSearchValueClearLink() {
const { clearButtonClassName } = this.props;
Expand All @@ -102,14 +102,12 @@ class PopoverOptionSet extends Component {
}

return (
<InputGroupAddon addonType="append">
<button
className={classNames(clearButtonClassName)}
onClick={this.handleSearchValueClear}
>
{i18n._t('PopoverOptionSet.CLEAR', 'Clear')}
</button>
</InputGroupAddon>
<button
className={classNames(clearButtonClassName)}
onClick={this.handleSearchValueClear}
>
{i18n._t('PopoverOptionSet.CLEAR', 'Clear')}
</button>
);
}

Expand Down
Loading