/*
 * Copyright (C) Contributors to the Suwayomi project
 *
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at https://mozilla.org/MPL/2.0/.
 */

import ArrowDownward from '@mui/icons-material/ArrowDownward';
import ArrowUpward from '@mui/icons-material/ArrowUpward';
import { memo } from 'react';
import type { RadioInputProps } from '@/base/components/inputs/RadioInput.tsx';
import { RadioInput } from '@/base/components/inputs/RadioInput.tsx';

interface IProps extends RadioInputProps {
    sortDescending?: boolean | null | undefined;
}

export const SortRadioInput = memo(({ sortDescending, checkedIcon, ...rest }: IProps) => (
    <RadioInput
        {...rest}
        checkedIcon={
            checkedIcon ?? (sortDescending ? <ArrowDownward color="primary" /> : <ArrowUpward color="primary" />)
        }
    />
));
