mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2025-01-11 02:37:22 +03:00
Fixed block and inline dropdown buttons
This commit is contained in:
parent
3da2b56426
commit
afc574aceb
5 changed files with 13 additions and 7 deletions
|
@ -17,7 +17,7 @@ export const ShortUrlsFilterDropdown = (
|
||||||
const onFilterClick = (key: keyof ShortUrlsFilter) => () => onChange({ ...selected, [key]: !selected?.[key] });
|
const onFilterClick = (key: keyof ShortUrlsFilter) => () => onChange({ ...selected, [key]: !selected?.[key] });
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<DropdownBtn text="Filters" dropdownClassName={className} className="me-3" right minWidth={250}>
|
<DropdownBtn text="Filters" dropdownClassName={className} inline right minWidth={250}>
|
||||||
<DropdownItem header>Visits:</DropdownItem>
|
<DropdownItem header>Visits:</DropdownItem>
|
||||||
<DropdownItem active={excludeBots} onClick={onFilterClick('excludeBots')}>Ignore visits from bots</DropdownItem>
|
<DropdownItem active={excludeBots} onClick={onFilterClick('excludeBots')}>Ignore visits from bots</DropdownItem>
|
||||||
|
|
||||||
|
|
|
@ -2,13 +2,17 @@
|
||||||
|
|
||||||
@import '../utils/mixins/vertical-align';
|
@import '../utils/mixins/vertical-align';
|
||||||
|
|
||||||
|
.dropdown-btn__toggle.dropdown-btn__toggle {
|
||||||
|
text-align: left;
|
||||||
|
padding-right: 1.75rem;
|
||||||
|
}
|
||||||
|
|
||||||
.dropdown-btn__toggle.dropdown-btn__toggle,
|
.dropdown-btn__toggle.dropdown-btn__toggle,
|
||||||
.dropdown-btn__toggle.dropdown-btn__toggle:not(:disabled):not(.disabled).active,
|
.dropdown-btn__toggle.dropdown-btn__toggle:not(:disabled):not(.disabled).active,
|
||||||
.dropdown-btn__toggle.dropdown-btn__toggle:not(:disabled):not(.disabled):active,
|
.dropdown-btn__toggle.dropdown-btn__toggle:not(:disabled):not(.disabled):active,
|
||||||
.dropdown-btn__toggle.dropdown-btn__toggle:not(:disabled):not(.disabled):focus,
|
.dropdown-btn__toggle.dropdown-btn__toggle:not(:disabled):not(.disabled):focus,
|
||||||
.dropdown-btn__toggle.dropdown-btn__toggle:not(:disabled):not(.disabled):hover,
|
.dropdown-btn__toggle.dropdown-btn__toggle:not(:disabled):not(.disabled):hover,
|
||||||
.show > .dropdown-btn__toggle.dropdown-btn__toggle.dropdown-toggle {
|
.show > .dropdown-btn__toggle.dropdown-btn__toggle.dropdown-toggle {
|
||||||
text-align: left;
|
|
||||||
color: var(--input-text-color);
|
color: var(--input-text-color);
|
||||||
background-color: var(--primary-color);
|
background-color: var(--primary-color);
|
||||||
border-color: var(--input-border-color);
|
border-color: var(--input-border-color);
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import classNames from 'classnames';
|
||||||
import type { FC, PropsWithChildren } from 'react';
|
import type { FC, PropsWithChildren } from 'react';
|
||||||
import { Dropdown, DropdownMenu, DropdownToggle } from 'reactstrap';
|
import { Dropdown, DropdownMenu, DropdownToggle } from 'reactstrap';
|
||||||
import { useToggle } from './helpers/hooks';
|
import { useToggle } from './helpers/hooks';
|
||||||
|
@ -9,14 +10,15 @@ export type DropdownBtnProps = PropsWithChildren<{
|
||||||
className?: string;
|
className?: string;
|
||||||
dropdownClassName?: string;
|
dropdownClassName?: string;
|
||||||
right?: boolean;
|
right?: boolean;
|
||||||
|
inline?: boolean;
|
||||||
minWidth?: number;
|
minWidth?: number;
|
||||||
}>;
|
}>;
|
||||||
|
|
||||||
export const DropdownBtn: FC<DropdownBtnProps> = (
|
export const DropdownBtn: FC<DropdownBtnProps> = (
|
||||||
{ text, disabled = false, className = '', children, dropdownClassName, right = false, minWidth },
|
{ text, disabled = false, className, children, dropdownClassName, right = false, minWidth, inline },
|
||||||
) => {
|
) => {
|
||||||
const [isOpen, toggle] = useToggle();
|
const [isOpen, toggle] = useToggle();
|
||||||
const toggleClasses = `dropdown-btn__toggle btn-block ${className}`;
|
const toggleClasses = classNames('dropdown-btn__toggle', className, { 'btn-block': !inline });
|
||||||
const style = { minWidth: minWidth && `${minWidth}px` };
|
const style = { minWidth: minWidth && `${minWidth}px` };
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
|
@ -5,10 +5,10 @@ import type { ButtonProps } from 'reactstrap';
|
||||||
import { Button } from 'reactstrap';
|
import { Button } from 'reactstrap';
|
||||||
import { prettify } from './helpers/numbers';
|
import { prettify } from './helpers/numbers';
|
||||||
|
|
||||||
interface ExportBtnProps extends Omit<ButtonProps, 'outline' | 'color' | 'disabled'> {
|
type ExportBtnProps = Omit<ButtonProps, 'outline' | 'color' | 'disabled'> & {
|
||||||
amount?: number;
|
amount?: number;
|
||||||
loading?: boolean;
|
loading?: boolean;
|
||||||
}
|
};
|
||||||
|
|
||||||
export const ExportBtn: FC<ExportBtnProps> = ({ amount = 0, loading = false, ...rest }) => (
|
export const ExportBtn: FC<ExportBtnProps> = ({ amount = 0, loading = false, ...rest }) => (
|
||||||
<Button {...rest} outline color="primary" disabled={loading}>
|
<Button {...rest} outline color="primary" disabled={loading}>
|
||||||
|
|
|
@ -22,7 +22,7 @@ export const VisitsFilterDropdown = (
|
||||||
const onBotsClick = () => onChange({ ...selected, excludeBots: !selected?.excludeBots });
|
const onBotsClick = () => onChange({ ...selected, excludeBots: !selected?.excludeBots });
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<DropdownBtn text="Filters" dropdownClassName={className} className="me-3" right minWidth={250}>
|
<DropdownBtn text="Filters" dropdownClassName={className} inline right minWidth={250}>
|
||||||
<DropdownItem header>Bots:</DropdownItem>
|
<DropdownItem header>Bots:</DropdownItem>
|
||||||
<DropdownItem active={excludeBots} onClick={onBotsClick}>Exclude potential bots</DropdownItem>
|
<DropdownItem active={excludeBots} onClick={onBotsClick}>Exclude potential bots</DropdownItem>
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue