Skip to content

Commit

Permalink
feat(*): fix eslint
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex Fenko committed Feb 27, 2020
1 parent fc2d810 commit c4f5261
Show file tree
Hide file tree
Showing 13 changed files with 275 additions and 273 deletions.
3 changes: 3 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ module.exports = {
rules: {
'import/no-extraneous-dependencies': 0,
'react/prop-types': 'off',
'react/jsx-indent': 0,
'react/jsx-indent-props': 0,
indent: ['error', 2, { SwitchCase: 1 }],
}
}]
};
50 changes: 25 additions & 25 deletions packages/amount/src/Component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ import { formatAmount } from '../../utils';
*/

import {
AMOUNT_MAJOR_MINOR_PARTS_SEPARATOR,
THINSP, CURRENCY_CODES
AMOUNT_MAJOR_MINOR_PARTS_SEPARATOR,
THINSP, CURRENCY_CODES
} from '../../configs/currencyCodes';

/**
Expand All @@ -38,31 +38,31 @@ type Props = {
*/

export const Amount: React.FC<Props> = ({
value,
minority,
hideMinority = false,
value,
minority,
hideMinority = false,

className,
minorityClassName
className,
minorityClassName
}) => {
const { majorPart, minorPart, currencySymbol } = formatAmount({
value,
currency: {
code: CURRENCY_CODES.RUR, // TODO need work
minority
}
});
const { majorPart, minorPart, currencySymbol } = formatAmount({
value,
currency: {
code: CURRENCY_CODES.RUR, // TODO need work
minority
}
});

return (
<div className={ className }>
{ majorPart }
{ !hideMinority && minorPart && AMOUNT_MAJOR_MINOR_PARTS_SEPARATOR }
return (
<div className={ className }>
{ majorPart }
{ !hideMinority && minorPart && AMOUNT_MAJOR_MINOR_PARTS_SEPARATOR }

{ !hideMinority && <span className={ minorityClassName }>{ minorPart }</span> }
<span>
{ THINSP }
{ currencySymbol }
</span>
</div>
);
{ !hideMinority && <span className={ minorityClassName }>{ minorPart }</span> }
<span>
{ THINSP }
{ currencySymbol }
</span>
</div>
);
};
58 changes: 29 additions & 29 deletions packages/button/src/Component.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import React from 'react';
import { action } from '@storybook/addon-actions';
import { withDesign } from 'storybook-addon-designs';
import {
withKnobs, text, select, boolean
withKnobs, text, select, boolean
} from '@storybook/addon-knobs';

/**
Expand All @@ -17,39 +17,39 @@ import {
import { Button } from './Component';

export default {
title: 'Common',
component: Button,
decorators: [withDesign, withKnobs]
title: 'Common',
component: Button,
decorators: [withDesign, withKnobs]
};

export const ButtonStory = () => (
<Button
type={ select(
'Type',
['primary', 'secondary', 'extra', 'dashed', 'link'],
'primary'
) }
title={ text('Title', '') }
disabled={ boolean('Disabled', false) }
htmlType={ select('htmlType', ['button', 'reset', 'submit'], 'button') }
loading={ boolean('Loading', false) }
size={ select('Size', ['xs', 's', 'm', 'l'], 'm') }
block={ boolean('Block', false) }
className={ text('className', '') }
dataTestId={ text('dataTestId', '') }
onClick={ action('click') }
>
{ text('Label', 'Оплатить') }
</Button>
<Button
type={ select(
'Type',
['primary', 'secondary', 'extra', 'dashed', 'link'],
'primary'
) }
title={ text('Title', '') }
disabled={ boolean('Disabled', false) }
htmlType={ select('htmlType', ['button', 'reset', 'submit'], 'button') }
loading={ boolean('Loading', false) }
size={ select('Size', ['xs', 's', 'm', 'l'], 'm') }
block={ boolean('Block', false) }
className={ text('className', '') }
dataTestId={ text('dataTestId', '') }
onClick={ action('click') }
>
{ text('Label', 'Оплатить') }
</Button>
);

ButtonStory.story = {
name: 'Button',
parameters: {
design: {
type: 'figma',
// public link for testing
url: 'https://www.figma.com/file/cgApcObBwfNQzVVzJNqxoQ/Button'
}
name: 'Button',
parameters: {
design: {
type: 'figma',
// public link for testing
url: 'https://www.figma.com/file/cgApcObBwfNQzVVzJNqxoQ/Button'
}
}
};
66 changes: 33 additions & 33 deletions packages/button/src/Component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,39 +35,39 @@ type Props = {
*/

export const Button: React.FC<Props> = ({
children,
type = 'secondary',
title = '',
disabled = false,
htmlType = 'button',
icon,
// loading = false,
size = 'm',
block = false,
className = '',
dataTestId,
children,
type = 'secondary',
title = '',
disabled = false,
htmlType = 'button',
icon,
// loading = false,
size = 'm',
block = false,
className = '',
dataTestId,

onClick
onClick
}) => (
// TODO need work
// eslint-disable-next-line react/button-has-type
<button
type={ htmlType }
title={ title }
disabled={ disabled }
className={ cn(
styles.component,
styles[type],
styles[size],
{
[styles.block]: block
},
className
) }
onClick={ onClick }
data-test-id={ dataTestId }
>
{ icon && icon }
{ children }
</button>
// TODO need work
// eslint-disable-next-line react/button-has-type
<button
type={ htmlType }
title={ title }
disabled={ disabled }
className={ cn(
styles.component,
styles[type],
styles[size],
{
[styles.block]: block
},
className
) }
onClick={ onClick }
data-test-id={ dataTestId }
>
{ icon && icon }
{ children }
</button>
);

0 comments on commit c4f5261

Please sign in to comment.