+
-
);
}
-export default React.forwardRef(MediaSettingsMenuBack);
+export default React.forwardRef(SettingsMenuBack);
diff --git a/src/lib/viewers/controls/settings/SettingsMenuItem.scss b/src/lib/viewers/controls/settings/SettingsMenuItem.scss
new file mode 100644
index 000000000..74d43488d
--- /dev/null
+++ b/src/lib/viewers/controls/settings/SettingsMenuItem.scss
@@ -0,0 +1,42 @@
+@import './styles';
+
+.bp-SettingsMenuItem {
+ @include bp-SettingsRow;
+
+ &:hover {
+ background-color: $hover-blue-background;
+
+ .bp-SettingsMenuItem-label {
+ color: lighten($blue-steel, 50%);
+ }
+
+ .bp-SettingsMenuItem-value {
+ color: $blue-steel;
+ }
+ }
+
+ .bp-is-focused &:focus {
+ background-color: $box-blue;
+
+ .bp-SettingsMenuItem-arrow {
+ fill: $white;
+ }
+
+ .bp-SettingsMenuItem-label,
+ .bp-SettingsMenuItem-value {
+ color: $white;
+ }
+ }
+}
+
+.bp-SettingsMenuItem-arrow {
+ @include bp-SettingsRow-cell;
+}
+
+.bp-SettingsMenuItem-label {
+ @include bp-SettingsRow-label;
+}
+
+.bp-SettingsMenuItem-value {
+ @include bp-SettingsRow-value;
+}
diff --git a/src/lib/viewers/controls/media/MediaSettings/MediaSettingsMenuItem.tsx b/src/lib/viewers/controls/settings/SettingsMenuItem.tsx
similarity index 57%
rename from src/lib/viewers/controls/media/MediaSettings/MediaSettingsMenuItem.tsx
rename to src/lib/viewers/controls/settings/SettingsMenuItem.tsx
index 4004bbebd..03163a4fd 100644
--- a/src/lib/viewers/controls/media/MediaSettings/MediaSettingsMenuItem.tsx
+++ b/src/lib/viewers/controls/settings/SettingsMenuItem.tsx
@@ -1,9 +1,9 @@
import React from 'react';
import classNames from 'classnames';
-import IconArrowRight24 from '../../icons/IconArrowRight24';
-import MediaSettingsContext, { Menu } from './MediaSettingsContext';
-import { decodeKeydown } from '../../../../util';
-import './MediaSettingsMenuItem.scss';
+import IconArrowRight24 from '../icons/IconArrowRight24';
+import SettingsContext, { Menu } from './SettingsContext';
+import { decodeKeydown } from '../../../util';
+import './SettingsMenuItem.scss';
export type Props = {
className?: string;
@@ -13,9 +13,9 @@ export type Props = {
};
export type Ref = HTMLDivElement;
-function MediaSettingsMenuItem(props: Props, ref: React.Ref
[): JSX.Element {
+function SettingsMenuItem(props: Props, ref: React.Ref][): JSX.Element {
const { className, label, target, value } = props;
- const { setActiveMenu } = React.useContext(MediaSettingsContext);
+ const { setActiveMenu } = React.useContext(SettingsContext);
const handleClick = (): void => {
setActiveMenu(target);
@@ -35,21 +35,21 @@ function MediaSettingsMenuItem(props: Props, ref: React.Ref][): JSX.Element {
]
-
+
{label}
-
{value}
-
);
}
-export default React.forwardRef(MediaSettingsMenuItem);
+export default React.forwardRef(SettingsMenuItem);
diff --git a/src/lib/viewers/controls/settings/SettingsRadioItem.scss b/src/lib/viewers/controls/settings/SettingsRadioItem.scss
new file mode 100644
index 000000000..dcca6b22d
--- /dev/null
+++ b/src/lib/viewers/controls/settings/SettingsRadioItem.scss
@@ -0,0 +1,51 @@
+@import './styles';
+
+.bp-SettingsRadioItem {
+ @include bp-SettingsRow;
+
+ &.bp-is-selected {
+ .bp-SettingsRadioItem-check-icon {
+ visibility: visible;
+ }
+
+ .bp-SettingsRadioItem-value {
+ color: $box-blue;
+ }
+ }
+
+ &:hover {
+ background-color: $hover-blue-background;
+
+ .bp-SettingsRadioItem-check-icon {
+ fill: $blue-steel;
+ }
+
+ .bp-SettingsRadioItem-value {
+ color: $blue-steel;
+ }
+ }
+
+ .bp-is-focused &:focus {
+ background-color: $box-blue;
+
+ .bp-SettingsRadioItem-check-icon {
+ fill: $white;
+ }
+
+ .bp-SettingsRadioItem-value {
+ color: $white;
+ }
+ }
+}
+
+.bp-SettingsRadioItem-check {
+ @include bp-SettingsRow-cell;
+}
+
+.bp-SettingsRadioItem-check-icon {
+ visibility: hidden;
+}
+
+.bp-SettingsRadioItem-value {
+ @include bp-SettingsRow-value;
+}
diff --git a/src/lib/viewers/controls/media/MediaSettings/MediaSettingsRadioItem.tsx b/src/lib/viewers/controls/settings/SettingsRadioItem.tsx
similarity index 61%
rename from src/lib/viewers/controls/media/MediaSettings/MediaSettingsRadioItem.tsx
rename to src/lib/viewers/controls/settings/SettingsRadioItem.tsx
index 0c4394575..cc5d822a3 100644
--- a/src/lib/viewers/controls/media/MediaSettings/MediaSettingsRadioItem.tsx
+++ b/src/lib/viewers/controls/settings/SettingsRadioItem.tsx
@@ -1,8 +1,8 @@
import React from 'react';
import classNames from 'classnames';
-import IconCheckMark24 from '../../icons/IconCheckMark24';
-import { decodeKeydown } from '../../../../util';
-import './MediaSettingsRadioItem.scss';
+import IconCheckMark24 from '../icons/IconCheckMark24';
+import { decodeKeydown } from '../../../util';
+import './SettingsRadioItem.scss';
export type Props
= {
className?: string;
@@ -14,7 +14,7 @@ export type Props = {
export type Ref = HTMLDivElement;
export type Value = boolean | number | string;
-function MediaSettingsRadioItem(props: Props, ref: React.Ref[): JSX.Element {
+function SettingsRadioItem(props: Props, ref: React.Ref][): JSX.Element {
const { className, isSelected, label, onChange, value } = props;
const handleClick = (): void => {
@@ -35,7 +35,7 @@ function MediaSettingsRadioItem(props: Props, ref: React.Ref
](props: Props
, ref: React.Ref
role="menuitemradio"
tabIndex={0}
>
-
-
+
+
-
{label || value}
+
{label || value}
);
}
-export default React.forwardRef(MediaSettingsRadioItem) as typeof MediaSettingsRadioItem;
+export default React.forwardRef(SettingsRadioItem) as typeof SettingsRadioItem;
diff --git a/src/lib/viewers/controls/media/MediaSettings/MediaSettingsToggle.scss b/src/lib/viewers/controls/settings/SettingsToggle.scss
similarity index 56%
rename from src/lib/viewers/controls/media/MediaSettings/MediaSettingsToggle.scss
rename to src/lib/viewers/controls/settings/SettingsToggle.scss
index af7b78607..3281943c7 100644
--- a/src/lib/viewers/controls/media/MediaSettings/MediaSettingsToggle.scss
+++ b/src/lib/viewers/controls/settings/SettingsToggle.scss
@@ -1,16 +1,16 @@
@import '../styles';
-.bp-MediaSettingsToggle {
- @include bp-MediaButton;
+.bp-SettingsToggle {
+ @include bp-Control;
&.bp-is-open {
- .bp-MediaSettingsToggle-icon {
+ .bp-SettingsToggle-icon {
transform: rotate(60deg);
}
}
}
-.bp-MediaSettingsToggle-icon {
+.bp-SettingsToggle-icon {
transform: rotate(0);
transition: transform 300ms ease;
}
diff --git a/src/lib/viewers/controls/settings/SettingsToggle.tsx b/src/lib/viewers/controls/settings/SettingsToggle.tsx
new file mode 100644
index 000000000..ebe6b09e2
--- /dev/null
+++ b/src/lib/viewers/controls/settings/SettingsToggle.tsx
@@ -0,0 +1,27 @@
+import React from 'react';
+import classNames from 'classnames';
+import IconGear24 from '../icons/IconGear24';
+import './SettingsToggle.scss';
+
+export type Props = {
+ isOpen: boolean;
+ onClick: () => void;
+};
+
+export type Ref = HTMLButtonElement;
+
+function SettingsToggle({ isOpen, onClick }: Props, ref: React.Ref[): JSX.Element {
+ return (
+
+ );
+}
+
+export default React.forwardRef(SettingsToggle);
diff --git a/src/lib/viewers/controls/media/MediaSettings/__tests__/MediaSettings-test.tsx b/src/lib/viewers/controls/settings/__tests__/Settings-test.tsx
similarity index 61%
rename from src/lib/viewers/controls/media/MediaSettings/__tests__/MediaSettings-test.tsx
rename to src/lib/viewers/controls/settings/__tests__/Settings-test.tsx
index 8a59e0165..3b18f77bb 100644
--- a/src/lib/viewers/controls/media/MediaSettings/__tests__/MediaSettings-test.tsx
+++ b/src/lib/viewers/controls/settings/__tests__/Settings-test.tsx
@@ -1,27 +1,27 @@
import React from 'react';
import { act } from 'react-dom/test-utils';
import { mount, ReactWrapper } from 'enzyme';
-import MediaSettings from '../MediaSettings';
-import MediaSettingsToggle from '../MediaSettingsToggle';
-import MediaSettingsFlyout from '../MediaSettingsFlyout';
+import Settings from '../Settings';
+import SettingsToggle from '../SettingsToggle';
+import SettingsFlyout from '../SettingsFlyout';
-describe('MediaSettings', () => {
+describe('Settings', () => {
const getHostNode = (): HTMLDivElement => {
return document.body.appendChild(document.createElement('div'));
};
- const getWrapper = (props = {}): ReactWrapper => mount(, { attachTo: getHostNode() });
+ const getWrapper = (props = {}): ReactWrapper => mount(, { attachTo: getHostNode() });
describe('event handlers', () => {
test('should update the flyout and toggle button isOpen prop when clicked', () => {
const wrapper = getWrapper();
- expect(wrapper.find(MediaSettingsFlyout).prop('isOpen')).toBe(false);
- expect(wrapper.find(MediaSettingsToggle).prop('isOpen')).toBe(false);
+ expect(wrapper.find(SettingsFlyout).prop('isOpen')).toBe(false);
+ expect(wrapper.find(SettingsToggle).prop('isOpen')).toBe(false);
- wrapper.find(MediaSettingsToggle).simulate('click');
+ wrapper.find(SettingsToggle).simulate('click');
- expect(wrapper.find(MediaSettingsFlyout).prop('isOpen')).toBe(true);
- expect(wrapper.find(MediaSettingsToggle).prop('isOpen')).toBe(true);
+ expect(wrapper.find(SettingsFlyout).prop('isOpen')).toBe(true);
+ expect(wrapper.find(SettingsToggle).prop('isOpen')).toBe(true);
});
test.each`
@@ -56,20 +56,20 @@ describe('MediaSettings', () => {
return event;
};
- wrapper.find(MediaSettingsToggle).simulate('click'); // Open the controls
- expect(wrapper.find(MediaSettingsToggle).prop('isOpen')).toBe(true);
+ wrapper.find(SettingsToggle).simulate('click'); // Open the controls
+ expect(wrapper.find(SettingsToggle).prop('isOpen')).toBe(true);
act(() => {
document.dispatchEvent(getEvent(document.body)); // Click outside the controls
});
wrapper.update();
- expect(wrapper.find(MediaSettingsToggle).prop('isOpen')).toBe(false);
+ expect(wrapper.find(SettingsToggle).prop('isOpen')).toBe(false);
- wrapper.find(MediaSettingsToggle).simulate('click'); // Re-open the controls
- expect(wrapper.find(MediaSettingsToggle).prop('isOpen')).toBe(true);
+ wrapper.find(SettingsToggle).simulate('click'); // Re-open the controls
+ expect(wrapper.find(SettingsToggle).prop('isOpen')).toBe(true);
- wrapper.find(MediaSettingsFlyout).simulate('click'); // Click within the controls
- expect(wrapper.find(MediaSettingsToggle).prop('isOpen')).toBe(true);
+ wrapper.find(SettingsFlyout).simulate('click'); // Click within the controls
+ expect(wrapper.find(SettingsToggle).prop('isOpen')).toBe(true);
});
test('should stop propagation on all keydown events to prevent triggering global event listeners', () => {
@@ -89,9 +89,9 @@ describe('MediaSettings', () => {
test('should return a valid wrapper', () => {
const wrapper = getWrapper();
- expect(wrapper.getDOMNode()).toHaveClass('bp-MediaSettings');
- expect(wrapper.exists(MediaSettingsFlyout)).toBe(true);
- expect(wrapper.exists(MediaSettingsToggle)).toBe(true);
+ expect(wrapper.getDOMNode()).toHaveClass('bp-Settings');
+ expect(wrapper.exists(SettingsFlyout)).toBe(true);
+ expect(wrapper.exists(SettingsToggle)).toBe(true);
});
});
});
diff --git a/src/lib/viewers/controls/media/MediaSettings/__tests__/MediaSettingsContext-test.tsx b/src/lib/viewers/controls/settings/__tests__/SettingsContext-test.tsx
similarity index 58%
rename from src/lib/viewers/controls/media/MediaSettings/__tests__/MediaSettingsContext-test.tsx
rename to src/lib/viewers/controls/settings/__tests__/SettingsContext-test.tsx
index 6ef990d12..3318c9e08 100644
--- a/src/lib/viewers/controls/media/MediaSettings/__tests__/MediaSettingsContext-test.tsx
+++ b/src/lib/viewers/controls/settings/__tests__/SettingsContext-test.tsx
@@ -1,20 +1,18 @@
import React from 'react';
import { mount } from 'enzyme';
-import MediaSettingsContext, { Context, Menu } from '../MediaSettingsContext';
+import SettingsContext, { Context, Menu } from '../SettingsContext';
-describe('MediaSettingsContext', () => {
+describe('SettingsContext', () => {
const getContext = (): Context => ({
activeMenu: Menu.MAIN,
setActiveMenu: jest.fn(),
setActiveRect: jest.fn(),
});
- const TestComponent = (): JSX.Element => (
- ]{React.useContext(MediaSettingsContext).activeMenu}
- );
+ const TestComponent = (): JSX.Element => {React.useContext(SettingsContext).activeMenu}
;
test('should populate its context values', () => {
const wrapper = mount(, {
- wrappingComponent: MediaSettingsContext.Provider,
+ wrappingComponent: SettingsContext.Provider,
wrappingComponentProps: { value: getContext() },
});
diff --git a/src/lib/viewers/controls/media/MediaSettings/__tests__/MediaSettingsFlyout-test.tsx b/src/lib/viewers/controls/settings/__tests__/SettingsFlyout-test.tsx
similarity index 84%
rename from src/lib/viewers/controls/media/MediaSettings/__tests__/MediaSettingsFlyout-test.tsx
rename to src/lib/viewers/controls/settings/__tests__/SettingsFlyout-test.tsx
index ac8502a8d..6243f0579 100644
--- a/src/lib/viewers/controls/media/MediaSettings/__tests__/MediaSettingsFlyout-test.tsx
+++ b/src/lib/viewers/controls/settings/__tests__/SettingsFlyout-test.tsx
@@ -1,14 +1,14 @@
import React from 'react';
import { act } from 'react-dom/test-utils';
import { mount, ReactWrapper } from 'enzyme';
-import MediaSettingsContext, { Context } from '../MediaSettingsContext';
-import MediaSettingsFlyout from '../MediaSettingsFlyout';
+import SettingsContext, { Context } from '../SettingsContext';
+import SettingsFlyout from '../SettingsFlyout';
-describe('MediaSettingsFlyout', () => {
+describe('SettingsFlyout', () => {
const getContext = (): Partial => ({ activeRect: undefined });
const getWrapper = (props = {}, context = getContext()): ReactWrapper =>
- mount(, {
- wrappingComponent: MediaSettingsContext.Provider,
+ mount(, {
+ wrappingComponent: SettingsContext.Provider,
wrappingComponentProps: { value: context },
});
@@ -58,7 +58,7 @@ describe('MediaSettingsFlyout', () => {
test('should return a valid wrapper', () => {
const wrapper = getWrapper();
- expect(wrapper.getDOMNode()).toHaveClass('bp-MediaSettingsFlyout');
+ expect(wrapper.getDOMNode()).toHaveClass('bp-SettingsFlyout');
});
});
});
diff --git a/src/lib/viewers/controls/media/MediaSettings/__tests__/MediaSettingsMenu-test.tsx b/src/lib/viewers/controls/settings/__tests__/SettingsMenu-test.tsx
similarity index 89%
rename from src/lib/viewers/controls/media/MediaSettings/__tests__/MediaSettingsMenu-test.tsx
rename to src/lib/viewers/controls/settings/__tests__/SettingsMenu-test.tsx
index 73323c072..b43f92ef5 100644
--- a/src/lib/viewers/controls/media/MediaSettings/__tests__/MediaSettingsMenu-test.tsx
+++ b/src/lib/viewers/controls/settings/__tests__/SettingsMenu-test.tsx
@@ -1,10 +1,10 @@
import React from 'react';
import { act } from 'react-dom/test-utils';
import { mount, ReactWrapper } from 'enzyme';
-import MediaSettingsContext, { Context, Menu } from '../MediaSettingsContext';
-import MediaSettingsMenu from '../MediaSettingsMenu';
+import SettingsContext, { Context, Menu } from '../SettingsContext';
+import SettingsMenu from '../SettingsMenu';
-describe('MediaSettingsMenu', () => {
+describe('SettingsMenu', () => {
const getContext = (overrides = {}): Partial => ({
activeMenu: Menu.MAIN,
setActiveRect: jest.fn(),
@@ -15,14 +15,14 @@ describe('MediaSettingsMenu', () => {
};
const getWrapper = (props = {}, context = getContext()): ReactWrapper =>
mount(
-
+
- ,
+ ,
{
attachTo: getHostNode(),
- wrappingComponent: MediaSettingsContext.Provider,
+ wrappingComponent: SettingsContext.Provider,
wrappingComponentProps: { value: context },
},
);
@@ -86,7 +86,7 @@ describe('MediaSettingsMenu', () => {
const wrapper = getWrapper();
const element = wrapper.getDOMNode();
- expect(element).toHaveClass('bp-MediaSettingsMenu');
+ expect(element).toHaveClass('bp-SettingsMenu');
expect(element).toHaveAttribute('role', 'menu');
});
});
diff --git a/src/lib/viewers/controls/media/MediaSettings/__tests__/MediaSettingsMenuBack-test.tsx b/src/lib/viewers/controls/settings/__tests__/SettingsMenuBack-test.tsx
similarity index 70%
rename from src/lib/viewers/controls/media/MediaSettings/__tests__/MediaSettingsMenuBack-test.tsx
rename to src/lib/viewers/controls/settings/__tests__/SettingsMenuBack-test.tsx
index 5dd00c1af..8a85e7d05 100644
--- a/src/lib/viewers/controls/media/MediaSettings/__tests__/MediaSettingsMenuBack-test.tsx
+++ b/src/lib/viewers/controls/settings/__tests__/SettingsMenuBack-test.tsx
@@ -1,14 +1,14 @@
import React from 'react';
import { mount, ReactWrapper } from 'enzyme';
-import IconArrowLeft24 from '../../../icons/IconArrowLeft24';
-import MediaSettingsContext, { Context } from '../MediaSettingsContext';
-import MediaSettingsMenuBack from '../MediaSettingsMenuBack';
+import IconArrowLeft24 from '../../icons/IconArrowLeft24';
+import SettingsContext, { Context } from '../SettingsContext';
+import SettingsMenuBack from '../SettingsMenuBack';
-describe('MediaSettingsMenuBack', () => {
+describe('SettingsMenuBack', () => {
const getContext = (): Partial => ({ setActiveMenu: jest.fn() });
const getWrapper = (props = {}, context = {}): ReactWrapper =>
- mount(, {
- wrappingComponent: MediaSettingsContext.Provider,
+ mount(, {
+ wrappingComponent: SettingsContext.Provider,
wrappingComponentProps: { value: context },
});
@@ -42,8 +42,8 @@ describe('MediaSettingsMenuBack', () => {
test('should return a valid wrapper', () => {
const wrapper = getWrapper();
- expect(wrapper.getDOMNode()).toHaveClass('bp-MediaSettingsMenuBack');
- expect(wrapper.find('.bp-MediaSettingsMenuBack-label').contains('Autoplay')).toBe(true);
+ expect(wrapper.getDOMNode()).toHaveClass('bp-SettingsMenuBack');
+ expect(wrapper.find('.bp-SettingsMenuBack-label').contains('Autoplay')).toBe(true);
expect(wrapper.exists(IconArrowLeft24)).toBe(true);
});
});
diff --git a/src/lib/viewers/controls/media/MediaSettings/__tests__/MediaSettingsMenuItem-test.tsx b/src/lib/viewers/controls/settings/__tests__/SettingsMenuItem-test.tsx
similarity index 66%
rename from src/lib/viewers/controls/media/MediaSettings/__tests__/MediaSettingsMenuItem-test.tsx
rename to src/lib/viewers/controls/settings/__tests__/SettingsMenuItem-test.tsx
index a12da1967..8c362f042 100644
--- a/src/lib/viewers/controls/media/MediaSettings/__tests__/MediaSettingsMenuItem-test.tsx
+++ b/src/lib/viewers/controls/settings/__tests__/SettingsMenuItem-test.tsx
@@ -1,14 +1,14 @@
import React from 'react';
import { mount, ReactWrapper } from 'enzyme';
-import IconArrowRight24 from '../../../icons/IconArrowRight24';
-import MediaSettingsContext, { Menu, Context } from '../MediaSettingsContext';
-import MediaSettingsMenuItem from '../MediaSettingsMenuItem';
+import IconArrowRight24 from '../../icons/IconArrowRight24';
+import SettingsContext, { Menu, Context } from '../SettingsContext';
+import SettingsMenuItem from '../SettingsMenuItem';
-describe('MediaSettingsMenuItem', () => {
+describe('SettingsMenuItem', () => {
const getContext = (): Partial => ({ setActiveMenu: jest.fn() });
const getWrapper = (props = {}, context = {}): ReactWrapper =>
- mount(, {
- wrappingComponent: MediaSettingsContext.Provider,
+ mount(, {
+ wrappingComponent: SettingsContext.Provider,
wrappingComponentProps: { value: context },
});
@@ -42,9 +42,9 @@ describe('MediaSettingsMenuItem', () => {
test('should return a valid wrapper', () => {
const wrapper = getWrapper();
- expect(wrapper.getDOMNode()).toHaveClass('bp-MediaSettingsMenuItem');
- expect(wrapper.find('.bp-MediaSettingsMenuItem-label').contains('Speed')).toBe(true);
- expect(wrapper.find('.bp-MediaSettingsMenuItem-value').contains('Normal')).toBe(true);
+ expect(wrapper.getDOMNode()).toHaveClass('bp-SettingsMenuItem');
+ expect(wrapper.find('.bp-SettingsMenuItem-label').contains('Speed')).toBe(true);
+ expect(wrapper.find('.bp-SettingsMenuItem-value').contains('Normal')).toBe(true);
expect(wrapper.exists(IconArrowRight24)).toBe(true);
});
});
diff --git a/src/lib/viewers/controls/media/MediaSettings/__tests__/MediaSettingsRadioItem-test.tsx b/src/lib/viewers/controls/settings/__tests__/SettingsRadioItem-test.tsx
similarity index 76%
rename from src/lib/viewers/controls/media/MediaSettings/__tests__/MediaSettingsRadioItem-test.tsx
rename to src/lib/viewers/controls/settings/__tests__/SettingsRadioItem-test.tsx
index a7bf59840..c82a5fad0 100644
--- a/src/lib/viewers/controls/media/MediaSettings/__tests__/MediaSettingsRadioItem-test.tsx
+++ b/src/lib/viewers/controls/settings/__tests__/SettingsRadioItem-test.tsx
@@ -1,11 +1,11 @@
import React from 'react';
import { shallow, ShallowWrapper } from 'enzyme';
-import IconCheckMark24 from '../../../icons/IconCheckMark24';
-import MediaSettingsRadioItem from '../MediaSettingsRadioItem';
+import IconCheckMark24 from '../../icons/IconCheckMark24';
+import SettingsRadioItem from '../SettingsRadioItem';
-describe('MediaSettingsRadioItem', () => {
+describe('SettingsRadioItem', () => {
const getWrapper = (props = {}): ShallowWrapper =>
- shallow();
+ shallow();
describe('event handlers', () => {
test('should set the active menu when clicked', () => {
@@ -43,8 +43,8 @@ describe('MediaSettingsRadioItem', () => {
test('should return a valid wrapper', () => {
const wrapper = getWrapper();
- expect(wrapper.hasClass('bp-MediaSettingsRadioItem')).toBe(true);
- expect(wrapper.find('.bp-MediaSettingsRadioItem-value').contains('1.0')).toBe(true);
+ expect(wrapper.hasClass('bp-SettingsRadioItem')).toBe(true);
+ expect(wrapper.find('.bp-SettingsRadioItem-value').contains('1.0')).toBe(true);
expect(wrapper.exists(IconCheckMark24)).toBe(true); // Rendered, but visually hidden by default
});
});
diff --git a/src/lib/viewers/controls/media/MediaSettings/__tests__/MediaSettingsToggle-test.tsx b/src/lib/viewers/controls/settings/__tests__/SettingsToggle-test.tsx
similarity index 66%
rename from src/lib/viewers/controls/media/MediaSettings/__tests__/MediaSettingsToggle-test.tsx
rename to src/lib/viewers/controls/settings/__tests__/SettingsToggle-test.tsx
index c90b87236..af0a74cde 100644
--- a/src/lib/viewers/controls/media/MediaSettings/__tests__/MediaSettingsToggle-test.tsx
+++ b/src/lib/viewers/controls/settings/__tests__/SettingsToggle-test.tsx
@@ -1,17 +1,17 @@
import React from 'react';
import { shallow, ShallowWrapper } from 'enzyme';
-import IconGear24 from '../../../icons/IconGear24';
-import MediaSettingsToggle from '../MediaSettingsToggle';
+import IconGear24 from '../../icons/IconGear24';
+import SettingsToggle from '../SettingsToggle';
-describe('MediaSettingsToggle', () => {
+describe('SettingsToggle', () => {
const getWrapper = (props = {}): ShallowWrapper =>
- shallow();
+ shallow();
describe('render', () => {
test('should return a valid wrapper', () => {
const wrapper = getWrapper();
- expect(wrapper.hasClass('bp-MediaSettingsToggle')).toBe(true);
+ expect(wrapper.hasClass('bp-SettingsToggle')).toBe(true);
expect(wrapper.exists(IconGear24)).toBe(true);
expect(wrapper.prop('title')).toBe('Settings');
});
diff --git a/src/lib/viewers/controls/media/MediaSettings/_styles.scss b/src/lib/viewers/controls/settings/_styles.scss
similarity index 67%
rename from src/lib/viewers/controls/media/MediaSettings/_styles.scss
rename to src/lib/viewers/controls/settings/_styles.scss
index 4e2c0e378..c1545e495 100644
--- a/src/lib/viewers/controls/media/MediaSettings/_styles.scss
+++ b/src/lib/viewers/controls/settings/_styles.scss
@@ -1,6 +1,6 @@
@import '../styles';
-@mixin bp-MediaSettingsRow {
+@mixin bp-SettingsRow {
display: table-row;
overflow: hidden;
white-space: nowrap;
@@ -8,13 +8,13 @@
cursor: pointer;
}
-@mixin bp-MediaSettingsRow-cell {
+@mixin bp-SettingsRow-cell {
display: table-cell;
vertical-align: middle;
}
-@mixin bp-MediaSettingsRow-label {
- @include bp-MediaSettingsRow-cell;
+@mixin bp-SettingsRow-label {
+ @include bp-SettingsRow-cell;
padding: 6px;
color: $downtown-grey;
@@ -24,8 +24,8 @@
text-transform: uppercase;
}
-@mixin bp-MediaSettingsRow-value {
- @include bp-MediaSettingsRow-cell;
+@mixin bp-SettingsRow-value {
+ @include bp-SettingsRow-cell;
padding: 6px 6px 6px 10px;
color: $sunset-grey;
diff --git a/src/lib/viewers/controls/settings/index.ts b/src/lib/viewers/controls/settings/index.ts
new file mode 100644
index 000000000..e735c7dfe
--- /dev/null
+++ b/src/lib/viewers/controls/settings/index.ts
@@ -0,0 +1,3 @@
+export * from './Settings';
+export * from './SettingsContext';
+export { default } from './Settings';
diff --git a/src/lib/viewers/media/MP3Settings.scss b/src/lib/viewers/media/MP3Settings.scss
new file mode 100644
index 000000000..87ac17a27
--- /dev/null
+++ b/src/lib/viewers/media/MP3Settings.scss
@@ -0,0 +1,7 @@
+@import '../controls/media/styles';
+
+.bp-MP3Settings {
+ .bp-SettingsToggle {
+ @include bp-MediaButton;
+ }
+}
diff --git a/src/lib/viewers/media/MP3Settings.tsx b/src/lib/viewers/media/MP3Settings.tsx
index cb4aa6015..c24a82d04 100644
--- a/src/lib/viewers/media/MP3Settings.tsx
+++ b/src/lib/viewers/media/MP3Settings.tsx
@@ -1,7 +1,8 @@
import React from 'react';
-import MediaSettings, { Menu } from '../controls/media/MediaSettings';
-import MediaSettingsAutoplay, { Props as AutoplayProps } from '../controls/media/MediaSettings/MediaSettingsAutoplay';
-import MediaSettingsRate, { Props as RateProps } from '../controls/media/MediaSettings/MediaSettingsRate';
+import Settings, { Menu } from '../controls/settings';
+import MediaSettingsMenuAutoplay, { Props as AutoplayProps } from '../controls/media/MediaSettingsMenuAutoplay';
+import MediaSettingsMenuRate, { Props as RateProps } from '../controls/media/MediaSettingsMenuRate';
+import './MP3Settings.scss';
export type Props = AutoplayProps & RateProps;
@@ -10,14 +11,14 @@ export default function MP3Settings({ autoplay, onAutoplayChange, onRateChange,
const rateValue = rate === '1.0' || !rate ? __('media_speed_normal') : rate;
return (
-
-
-
-
-
+
+
+
+
+
-
-
-
+
+
+
);
}
diff --git a/src/lib/viewers/media/__tests__/MP3Settings-test.tsx b/src/lib/viewers/media/__tests__/MP3Settings-test.tsx
index 8444a2f60..5eb0905a5 100644
--- a/src/lib/viewers/media/__tests__/MP3Settings-test.tsx
+++ b/src/lib/viewers/media/__tests__/MP3Settings-test.tsx
@@ -1,9 +1,9 @@
import React from 'react';
import { shallow, ShallowWrapper } from 'enzyme';
-import MediaSettings from '../../controls/media/MediaSettings/MediaSettings';
import MP3Settings from '../MP3Settings';
-import MediaSettingsMenu from '../../controls/media/MediaSettings/MediaSettingsMenu';
-import MediaSettingsMenuItem from '../../controls/media/MediaSettings/MediaSettingsMenuItem';
+import Settings from '../../controls/settings/Settings';
+import SettingsMenu from '../../controls/settings/SettingsMenu';
+import SettingsMenuItem from '../../controls/settings/SettingsMenuItem';
describe('MP3SettingsControls', () => {
const getWrapper = (props = {}): ShallowWrapper =>
@@ -21,9 +21,9 @@ describe('MP3SettingsControls', () => {
test('should return a valid wrapper', () => {
const wrapper = getWrapper();
- expect(wrapper.exists(MediaSettings)).toBe(true);
- expect(wrapper.exists(MediaSettingsMenu)).toBe(true);
- expect(wrapper.exists(MediaSettingsMenuItem)).toBe(true);
+ expect(wrapper.exists(Settings)).toBe(true);
+ expect(wrapper.exists(SettingsMenu)).toBe(true);
+ expect(wrapper.exists(SettingsMenuItem)).toBe(true);
});
test.each`