🐛 fix settings text color
This commit is contained in:
parent
167bbe88a0
commit
ad3db32fa3
2 changed files with 67 additions and 50 deletions
50
client/components/mobile/Selector.jsx
Normal file
50
client/components/mobile/Selector.jsx
Normal file
|
@ -0,0 +1,50 @@
|
||||||
|
import React from 'react';
|
||||||
|
import PropTypes from 'prop-types';
|
||||||
|
import styled from 'styled-components';
|
||||||
|
import { prop } from '../../theme';
|
||||||
|
|
||||||
|
|
||||||
|
const PreferenceTitle = styled.h4.attrs(props => ({ ...props, className: 'preference__title' }))`
|
||||||
|
color: ${prop('primaryTextColor')} !important;
|
||||||
|
`;
|
||||||
|
|
||||||
|
const Selector = ({
|
||||||
|
title, value, onSelect, options,
|
||||||
|
}) => (
|
||||||
|
<div className="preference">
|
||||||
|
{/* <h4 className="preference__title">{title}</h4> */}
|
||||||
|
<PreferenceTitle>{title}</PreferenceTitle>
|
||||||
|
{options.map(option => (
|
||||||
|
<div className="preference__options" key={option.id}>
|
||||||
|
<input
|
||||||
|
type="radio"
|
||||||
|
onChange={() => onSelect(option.value)}
|
||||||
|
aria-label={option.ariaLabel}
|
||||||
|
name={option.name}
|
||||||
|
id={option.id}
|
||||||
|
className="preference__radio-button"
|
||||||
|
value={option.value}
|
||||||
|
checked={value === option.value}
|
||||||
|
/>
|
||||||
|
<label htmlFor={option.id} className="preference__option">{option.label}</label>
|
||||||
|
</div>))}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
|
||||||
|
Selector.defaultProps = {
|
||||||
|
options: []
|
||||||
|
};
|
||||||
|
|
||||||
|
Selector.propTypes = {
|
||||||
|
title: PropTypes.string.isRequired,
|
||||||
|
value: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]).isRequired,
|
||||||
|
options: PropTypes.arrayOf(PropTypes.shape({
|
||||||
|
id: PropTypes.string,
|
||||||
|
name: PropTypes.string,
|
||||||
|
label: PropTypes.string,
|
||||||
|
ariaLabel: PropTypes.string,
|
||||||
|
})),
|
||||||
|
onSelect: PropTypes.func.isRequired,
|
||||||
|
};
|
||||||
|
|
||||||
|
export default Selector;
|
|
@ -10,6 +10,7 @@ import * as IdeActions from '../IDE/actions/ide';
|
||||||
|
|
||||||
import Screen from '../../components/mobile/MobileScreen';
|
import Screen from '../../components/mobile/MobileScreen';
|
||||||
import Header from '../../components/mobile/Header';
|
import Header from '../../components/mobile/Header';
|
||||||
|
import Selector from '../../components/mobile/Selector';
|
||||||
import { ExitIcon } from '../../common/icons';
|
import { ExitIcon } from '../../common/icons';
|
||||||
import { remSize } from '../../theme';
|
import { remSize } from '../../theme';
|
||||||
|
|
||||||
|
@ -24,43 +25,6 @@ const Content = styled.div`
|
||||||
margin-top: ${remSize(68)};
|
margin-top: ${remSize(68)};
|
||||||
`;
|
`;
|
||||||
|
|
||||||
const Selector = ({
|
|
||||||
title, value, onSelect, options,
|
|
||||||
}) => (
|
|
||||||
<div className="preference">
|
|
||||||
<h4 className="preference__title">{title}</h4>
|
|
||||||
{options.map(option => (
|
|
||||||
<div className="preference__options" key={option.id}>
|
|
||||||
<input
|
|
||||||
type="radio"
|
|
||||||
onChange={() => onSelect(option.value)}
|
|
||||||
aria-label={option.ariaLabel}
|
|
||||||
name={option.name}
|
|
||||||
id={option.id}
|
|
||||||
className="preference__radio-button"
|
|
||||||
value={option.value}
|
|
||||||
checked={value === option.value}
|
|
||||||
/>
|
|
||||||
<label htmlFor={option.id} className="preference__option">{option.label}</label>
|
|
||||||
</div>))}
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
|
|
||||||
Selector.defaultProps = {
|
|
||||||
options: []
|
|
||||||
};
|
|
||||||
|
|
||||||
Selector.propTypes = {
|
|
||||||
title: PropTypes.string.isRequired,
|
|
||||||
value: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]).isRequired,
|
|
||||||
options: PropTypes.arrayOf(PropTypes.shape({
|
|
||||||
id: PropTypes.string,
|
|
||||||
name: PropTypes.string,
|
|
||||||
label: PropTypes.string,
|
|
||||||
ariaLabel: PropTypes.string,
|
|
||||||
})),
|
|
||||||
onSelect: PropTypes.func.isRequired,
|
|
||||||
};
|
|
||||||
|
|
||||||
const SettingsHeader = styled(Header)`
|
const SettingsHeader = styled(Header)`
|
||||||
background: transparent
|
background: transparent
|
||||||
|
@ -121,7 +85,9 @@ const MobilePreferences = (props) => {
|
||||||
// useEffect(() => { });
|
// useEffect(() => { });
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Screen>
|
<Screen fullscreen>
|
||||||
|
<section>
|
||||||
|
|
||||||
<SettingsHeader>
|
<SettingsHeader>
|
||||||
<h1>Settings</h1>
|
<h1>Settings</h1>
|
||||||
|
|
||||||
|
@ -137,6 +103,7 @@ const MobilePreferences = (props) => {
|
||||||
{ preferences.map(option => <Selector key={`${option.title}wrapper`} {...option} />) }
|
{ preferences.map(option => <Selector key={`${option.title}wrapper`} {...option} />) }
|
||||||
</Content>
|
</Content>
|
||||||
</section>
|
</section>
|
||||||
|
</section>
|
||||||
</Screen>);
|
</Screen>);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue