mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-03-25 02:31:59 -05:00
Cleaned up classname properties in AdminX
refs. https://github.com/TryGhost/Team/issues/3354
This commit is contained in:
parent
f05b6a6037
commit
ef096d9c87
4 changed files with 24 additions and 10 deletions
|
@ -33,8 +33,8 @@ const Button: React.FC<IButton> = ({
|
|||
color = 'clear';
|
||||
}
|
||||
|
||||
let styles = className;
|
||||
|
||||
let styles = '';
|
||||
|
||||
styles += ' transition whitespace-nowrap flex items-center justify-center rounded-sm text-sm';
|
||||
styles += ((link && color !== 'clear' && color !== 'black') || (!link && color !== 'clear')) ? ' font-bold' : ' font-semibold';
|
||||
styles += !link ? `${size === 'sm' ? ' px-3 h-7 ' : ' px-4 h-9 '}` : '';
|
||||
|
@ -62,6 +62,7 @@ const Button: React.FC<IButton> = ({
|
|||
|
||||
styles += (fullWidth && !link) ? ' w-full' : '';
|
||||
styles += (disabled) ? ' opacity-40' : ' cursor-pointer';
|
||||
styles += ` ${className}`;
|
||||
|
||||
return (
|
||||
<button
|
||||
|
|
|
@ -6,11 +6,12 @@ import {IButton} from './Button';
|
|||
interface ButtonGroupProps {
|
||||
buttons: Array<IButton>;
|
||||
link?: boolean;
|
||||
className?: string;
|
||||
}
|
||||
|
||||
const ButtonGroup: React.FC<ButtonGroupProps> = ({buttons, link}) => {
|
||||
const ButtonGroup: React.FC<ButtonGroupProps> = ({buttons, link, className}) => {
|
||||
return (
|
||||
<div className={`flex items-center ${link ? 'gap-5' : 'gap-3'}`}>
|
||||
<div className={`flex items-center ${link ? 'gap-5' : 'gap-3'} ${className}`}>
|
||||
{buttons.map(({key, ...props}) => (
|
||||
<Button key={key} link={link} {...props} />
|
||||
))}
|
||||
|
|
|
@ -21,9 +21,21 @@ interface HeadingBaseProps {
|
|||
className?: string;
|
||||
}
|
||||
|
||||
type Heading1to5Props = { useLabelTag?: false, level?: Exclude<HeadingLevel, 6>, grey?: never } & HeadingBaseProps & React.HTMLAttributes<HTMLHeadingElement>
|
||||
type Heading6Props = { useLabelTag?: false, level: 6, grey?: boolean } & HeadingBaseProps & React.HTMLAttributes<HTMLHeadingElement>
|
||||
type HeadingLabelProps = { useLabelTag: true, level?: never, grey?: never } & HeadingBaseProps & React.LabelHTMLAttributes<HTMLLabelElement>
|
||||
type Heading1to5Props = {
|
||||
useLabelTag?: false,
|
||||
level?: Exclude<HeadingLevel, 6>,
|
||||
grey?: never
|
||||
} & HeadingBaseProps & React.HTMLAttributes<HTMLHeadingElement>
|
||||
|
||||
type Heading6Props = {
|
||||
useLabelTag?: false,
|
||||
level: 6,
|
||||
grey?: boolean } & HeadingBaseProps & React.HTMLAttributes<HTMLHeadingElement>
|
||||
|
||||
type HeadingLabelProps = {
|
||||
useLabelTag: true,
|
||||
level?: never,
|
||||
grey?: never } & HeadingBaseProps & React.LabelHTMLAttributes<HTMLLabelElement>
|
||||
|
||||
const Heading: React.FC<Heading1to5Props | Heading6Props | HeadingLabelProps> = ({
|
||||
level,
|
||||
|
|
|
@ -7,19 +7,19 @@ interface LinkProps extends React.ComponentPropsWithoutRef<'a'> {
|
|||
* Tailwind color name
|
||||
*/
|
||||
color?: string;
|
||||
classes?: string;
|
||||
children?: React.ReactNode;
|
||||
className?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Standard link with default styling
|
||||
*/
|
||||
const Link: React.FC<LinkProps> = ({href, color, classes, children, ...props}) => {
|
||||
const Link: React.FC<LinkProps> = ({href, color, className, children, ...props}) => {
|
||||
if (!color) {
|
||||
color = 'green';
|
||||
}
|
||||
|
||||
let styles = (color === 'black') ? `transition text-black hover:text-black-700 ${classes}` : `text-${color} hover:text-${color}-400 ${classes}`;
|
||||
let styles = (color === 'black') ? `transition text-black hover:text-black-700 ${className}` : `text-${color} hover:text-${color}-400 ${className}`;
|
||||
|
||||
return <a className={styles} href={href} {...props}>{children}</a>;
|
||||
};
|
||||
|
|
Loading…
Add table
Reference in a new issue