Removed all default export except for services and reducers

This commit is contained in:
Alejandro Celaya
2022-05-28 11:16:59 +02:00
parent 2cac1d9fd2
commit 1d60db25bd
92 changed files with 159 additions and 214 deletions

View File

@@ -14,7 +14,7 @@ interface BooleanControlWithTypeProps extends BooleanControlProps {
type: 'switch' | 'checkbox';
}
const BooleanControl: FC<BooleanControlWithTypeProps> = (
export const BooleanControl: FC<BooleanControlWithTypeProps> = (
{ checked = false, onChange = identity, className, children, type, inline = false },
) => {
const id = useDomId();
@@ -32,5 +32,3 @@ const BooleanControl: FC<BooleanControlWithTypeProps> = (
</span>
);
};
export default BooleanControl;

View File

@@ -1,4 +1,4 @@
import { FC } from 'react';
import BooleanControl, { BooleanControlProps } from './BooleanControl';
import { BooleanControl, BooleanControlProps } from './BooleanControl';
export const Checkbox: FC<BooleanControlProps> = (props) => <BooleanControl type="checkbox" {...props} />;

View File

@@ -8,7 +8,7 @@ import './DateInput.scss';
export type DateInputProps = ReactDatePickerProps;
const DateInput = (props: DateInputProps) => {
export const DateInput = (props: DateInputProps) => {
const { className, isClearable, selected } = props;
const showCalendarIcon = !isClearable || isNil(selected);
const ref = useRef<{ input: HTMLInputElement }>();
@@ -32,5 +32,3 @@ const DateInput = (props: DateInputProps) => {
</div>
);
};
export default DateInput;

View File

@@ -30,7 +30,9 @@ export type MessageProps = PropsWithChildren<{
type?: MessageType;
}>;
const Message: FC<MessageProps> = ({ className, children, loading = false, type = 'default', fullWidth = false }) => {
export const Message: FC<MessageProps> = (
{ className, children, loading = false, type = 'default', fullWidth = false },
) => {
const classes = classNames({
'col-md-12': fullWidth,
'col-md-10 offset-md-1': !fullWidth,
@@ -50,5 +52,3 @@ const Message: FC<MessageProps> = ({ className, children, loading = false, type
</Row>
);
};
export default Message;

View File

@@ -7,7 +7,7 @@ interface PaginationDropdownProps {
toggleClassName?: string;
}
const PaginationDropdown = ({ toggleClassName, ranges, value, setValue }: PaginationDropdownProps) => (
export const PaginationDropdown = ({ toggleClassName, ranges, value, setValue }: PaginationDropdownProps) => (
<UncontrolledDropdown>
<DropdownToggle caret color="link" className={toggleClassName}>Paginate</DropdownToggle>
<DropdownMenu end>
@@ -23,5 +23,3 @@ const PaginationDropdown = ({ toggleClassName, ranges, value, setValue }: Pagina
</DropdownMenu>
</UncontrolledDropdown>
);
export default PaginationDropdown;

View File

@@ -1,4 +1,4 @@
import { FC } from 'react';
import BooleanControl, { BooleanControlProps } from './BooleanControl';
import { BooleanControl, BooleanControlProps } from './BooleanControl';
export const ToggleSwitch: FC<BooleanControlProps> = (props) => <BooleanControl type="switch" {...props} />;

View File

@@ -1,5 +1,5 @@
import { endOfDay } from 'date-fns';
import DateInput from '../DateInput';
import { DateInput } from '../DateInput';
import { DateRange } from './types';
interface DateRangeRowProps extends DateRange {
@@ -8,7 +8,7 @@ interface DateRangeRowProps extends DateRange {
disabled?: boolean;
}
const DateRangeRow = (
export const DateRangeRow = (
{ startDate = null, endDate = null, disabled = false, onStartDateChange, onEndDateChange }: DateRangeRowProps,
) => (
<div className="row">
@@ -35,5 +35,3 @@ const DateRangeRow = (
</div>
</div>
);
export default DateRangeRow;

View File

@@ -10,7 +10,7 @@ import {
rangeIsInterval,
dateRangeIsEmpty,
} from './types';
import DateRangeRow from './DateRangeRow';
import { DateRangeRow } from './DateRangeRow';
import { DateIntervalDropdownItems } from './DateIntervalDropdownItems';
export interface DateRangeSelectorProps {

View File

@@ -1,6 +1,6 @@
import { isNil } from 'ramda';
import { rangeOf } from '../utils';
import LocalStorage from './LocalStorage';
import { LocalStorage } from './LocalStorage';
const HEX_COLOR_LENGTH = 6;
const HEX_DIGITS = '0123456789ABCDEF';
@@ -15,7 +15,7 @@ const hexColorToRgbArray = (colorHex: string): number[] =>
// HSP by Darel Rex Finley https://alienryderflex.com/hsp.html
const perceivedLightness = (r = 0, g = 0, b = 0) => round(sqrt(0.299 * r ** 2 + 0.587 * g ** 2 + 0.114 * b ** 2));
export default class ColorGenerator {
export class ColorGenerator {
private readonly colors: Record<string, string>;
private readonly lights: Record<string, boolean>;

View File

@@ -1,7 +1,7 @@
const PREFIX = 'shlink';
const buildPath = (path: string) => `${PREFIX}.${path}`;
export default class LocalStorage {
export class LocalStorage {
public constructor(private readonly localStorage: Storage) {}
public readonly get = <T>(key: string): T | undefined => {

View File

@@ -1,7 +1,7 @@
import Bottle from 'bottlejs';
import { useStateFlagTimeout } from '../helpers/hooks';
import LocalStorage from './LocalStorage';
import ColorGenerator from './ColorGenerator';
import { LocalStorage } from './LocalStorage';
import { ColorGenerator } from './ColorGenerator';
import { csvToJson, jsonToCsv } from '../helpers/csvjson';
const provideServices = (bottle: Bottle) => {