Skip to content

Commit

Permalink
Add/preferences/line height (#86)
Browse files Browse the repository at this point in the history
* add preferences for line height

* add style and step to PreferenceNumber

* remove editors from preferences label
  • Loading branch information
viankakrisna authored and CompuIves committed Jul 26, 2017
1 parent 9823f84 commit 0b773fa
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 5 deletions.
5 changes: 3 additions & 2 deletions src/app/components/Preference/PreferenceNumber.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,11 @@ export default class PreferenceInput extends React.PureComponent {
};

render() {
const { value } = this.props;
const { value, style, step } = this.props;
return (
<StyledInput
style={{ width: '3rem' }}
step={step}
style={{ width: '3rem', ...style }}
type="number"
value={value}
onChange={this.handleChange}
Expand Down
6 changes: 5 additions & 1 deletion src/app/components/sandbox/CodeEditor/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ const CodeContainer = styled.div`
.CodeMirror {
font-family: ${props =>
fontFamilies(props.fontFamily, 'Source Code Pro', 'monospace')};
line-height: ${props => props.lineHeight};
background: ${theme.background2()};
color: #e0e0e0;
height: 100%;
Expand Down Expand Up @@ -475,7 +476,10 @@ export default class CodeEditor extends React.PureComponent {
title={title}
path={modulePath}
/>
<CodeContainer fontFamily={preferences.fontFamily}>
<CodeContainer
fontFamily={preferences.fontFamily}
lineHeight={preferences.lineHeight}
>
<div
style={{ height: '100%', fontSize: preferences.fontSize || 14 }}
ref={this.getCodeMirror}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,17 +65,26 @@ const Preferences = ({ preferences, preferencesActions }: Props) => {
/>
<Rule />
<PaddedPreference
title="Editor font size"
title="Font size"
type="number"
{...bindValue('fontSize')}
/>
<Rule />
<PaddedPreference
title="Editor font family"
title="Font family"
type="string"
placeholder="Source Code Pro"
{...bindValue('fontFamily')}
/>
<Rule />
<PaddedPreference
title="Line height"
type="number"
placeholder="1.15"
step="0.05"
style={{ width: '4rem' }}
{...bindValue('lineHeight')}
/>
</PreferenceContainer>
</Container>
);
Expand Down
1 change: 1 addition & 0 deletions src/app/store/preferences/reducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ const initialState: Preferences = Object.keys(keys).reduce(
instantPreviewEnabled: false,
fontSize: 14,
fontFamily: '',
lineHeight: 1.15,
clearConsoleEnabled: false,
prettierConfig: DEFAULT_PRETTIER_CONFIG,
},
Expand Down

0 comments on commit 0b773fa

Please sign in to comment.