Skip to content
Merged
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
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { inject, observer } from 'app/componentConnectors';
import React, { FunctionComponent } from 'react';
import { useOvermind } from 'app/overmind';

import {
SubContainer,
Expand All @@ -9,16 +9,28 @@ import {
Rule,
} from '../../elements';

function PrettierComponent({ store, signals }) {
const PrettierComponent: FunctionComponent = () => {
const {
state: {
preferences: {
settings: { prettierConfig },
},
},
actions: {
preferences: { settingChanged },
},
} = useOvermind();

const bindValue = name => ({
value: store.preferences.settings.prettierConfig[name],
value: prettierConfig[name],
setValue: value =>
signals.preferences.settingChanged({
settingChanged({
name: `prettierConfig.${name}`,
value,
}),
});

const { fluid } = prettierConfig;
return (
<SubContainer>
<PreferenceContainer>
Expand All @@ -45,15 +57,15 @@ function PrettierComponent({ store, signals }) {
<Rule />
<PaddedPreference
style={{
opacity: store.preferences.settings.prettierConfig.fluid ? 0.5 : 1,
opacity: fluid ? 0.5 : 1,
}}
title="Print width"
type="number"
{...bindValue('printWidth')}
/>
<SubDescription
style={{
opacity: store.preferences.settings.prettierConfig.fluid ? 0.5 : 1,
opacity: fluid ? 0.5 : 1,
}}
>
Specify the line length that the printer will wrap on.
Expand Down Expand Up @@ -143,6 +155,6 @@ function PrettierComponent({ store, signals }) {
</PreferenceContainer>
</SubContainer>
);
}
};

export const Prettier = inject('store', 'signals')(observer(PrettierComponent));
export const Prettier = PrettierComponent;

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import React, { FunctionComponent } from 'react';

import Question from 'react-icons/lib/go/question';

import { Prettier } from './Prettier';
import { Title } from '../elements';

export const CodeFormatting: FunctionComponent = () => (
<div>
<Title>
Prettier Settings{' '}
<a
href="https://prettier.io/docs/en/options.html"
target="_blank"
rel="noopener noreferrer"
>
<Question style={{ marginBottom: '3px' }} />
</a>
</Title>

<Prettier />
</div>
);