Skip to content

Commit

Permalink
cs(docs): eslint fix
Browse files Browse the repository at this point in the history
  • Loading branch information
matej21 committed Jun 10, 2024
1 parent dbb7026 commit 4337bbc
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 32 deletions.
35 changes: 18 additions & 17 deletions docs/src/components/global/DocsCard/index.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import * as React from 'react';
import * as React from 'react'

import Link from '@docusaurus/Link';
import clsx from 'clsx';
import styles from './styles.module.css';
import useBaseUrl from '@docusaurus/useBaseUrl';
import Link from '@docusaurus/Link'
import clsx from 'clsx'
import styles from './styles.module.css'
import useBaseUrl from '@docusaurus/useBaseUrl'

interface Props extends React.HTMLAttributes<HTMLDivElement> {
href?: string;
Expand All @@ -17,45 +17,46 @@ interface Props extends React.HTMLAttributes<HTMLDivElement> {
}

function DocsCard(props: Props): JSX.Element {
const customClassName = props.className || '';
const isStatic = typeof props.href === 'undefined';
const isOutbound = typeof props.href !== 'undefined' ? /^http/.test(props.href) : false;
const header = props.header === 'undefined' ? null : <header className="Card-header"><span>{props.header}</span><span></span></header>;
const hoverIcon = props.hoverIcon || props.icon;
const customClassName = props.className || ''
const isStatic = typeof props.href === 'undefined'
const isOutbound = typeof props.href !== 'undefined' ? /^http/.test(props.href) : false
const header = props.header === 'undefined' ? null : <header className="Card-header"><span>{props.header}</span><span></span></header>
const hoverIcon = props.hoverIcon || props.icon

const content = (
<>
{/* eslint-disable-next-line react-hooks/rules-of-hooks */}
{props.img && <img src={useBaseUrl(props.img)} className="Card-image" />}
<div className="Card-container">
{props.header && header}
<div className="Card-content">{props.children}</div>
</div>
</>
);
)

const className = clsx({
'Card-with-image': typeof props.img !== 'undefined',
'Card-without-image': typeof props.img === 'undefined',
'Card-size-lg': props.size === 'lg',
[customClassName]: props.className,
});
})

if (isStatic) {
return (
<div className={className}>
<div className={clsx(styles.card, 'docs-card')}>{content}</div>
</div>
);
)
}

if (isOutbound) {
return (
<div className={className}>
<a className={clsx(styles.card, 'docs-card')} href={props.href} target="_blank">
<a className={clsx(styles.card, 'docs-card')} href={props.href} target="_blank" rel="noreferrer">
{content}
</a>
</div>
);
)
}

return (
Expand All @@ -64,7 +65,7 @@ function DocsCard(props: Props): JSX.Element {
{content}
</Link>
</div>
);
)
}

export default DocsCard;
export default DocsCard
8 changes: 4 additions & 4 deletions docs/src/components/global/DocsCards/index.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import React from 'react';
import React from 'react'

import './cards.css';
import './cards.css'

function DocsCards(props): JSX.Element {
return <docs-cards class={props.className}>{props.children}</docs-cards>;
return <docs-cards class={props.className}>{props.children}</docs-cards>
}

export default DocsCards;
export default DocsCards
8 changes: 4 additions & 4 deletions docs/src/components/propsTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ export const PropsTable: (props: PropsTableProps) => JSX.Element = ({ firstColum
</table>
)

export interface PropsTableRowProps {
prop?: string
export interface PropsTableRowProps {
prop?: string
propType?: string
description?: string
inherited?: string
required?: boolean
readOnly?: boolean
readOnly?: boolean
}

export const PropsTableRow: (props: PropsTableRowProps) => JSX.Element = ({ prop, propType, description, inherited, required, readOnly }) => (
Expand All @@ -42,7 +42,7 @@ export const PropsTableRow: (props: PropsTableRowProps) => JSX.Element = ({ prop
{propType && <p className="props-type-prop" dangerouslySetInnerHTML={{ __html: propType }} />}
{description && <p className="props-description-prop" dangerouslySetInnerHTML={{ __html: description }} />}
{inherited && <p className="props-inherited-prop">Inherited from <b>{inherited}</b></p>}
<div style={{ display: "flex", gap: "0.5em" }}>
<div style={{ display: 'flex', gap: '0.5em' }}>
{required && <p className="props-required-prop">Required</p>}
{readOnly && <p className="props-readonly-prop">Read Only</p>}
</div>
Expand Down
7 changes: 0 additions & 7 deletions docs/src/components/propsType.tsx

This file was deleted.

0 comments on commit 4337bbc

Please sign in to comment.