Skip to content

Commit

Permalink
fix: linting
Browse files Browse the repository at this point in the history
  • Loading branch information
ivan-aksamentov committed Apr 1, 2020
1 parent c76d206 commit 142edae
Showing 1 changed file with 2 additions and 14 deletions.
16 changes: 2 additions & 14 deletions src/components/Form/FormHelpButton.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react'

import { Button, Card, CardBody, CardHeader, UncontrolledPopover } from 'reactstrap'
import { Button, Card, CardBody, UncontrolledPopover } from 'reactstrap'

import { onlyText } from 'react-children-utilities'

Expand All @@ -12,18 +12,6 @@ function safeId(id: string) {
return id.replace('.', '-')
}

function getText(label: any) {
if (typeof label === 'string') {
return label
} else if (label.type === 'h2' || label.type === 'h3') {
return onlyText(label)
} else if (label.props && label.props.children) {
return onlyText(label.props.children[0])
} else {
return ''
}
}

export interface FormHelpButtonProps {
identifier: string
label: string | React.ReactNode
Expand All @@ -48,7 +36,7 @@ export default function FormHelpButton({ identifier, label, help }: FormHelpButt
<UncontrolledPopover placement="right" target={safeId(identifier)} trigger="legacy" hideArrow>
<Card className="card--help">
<CardBody>
{label && <h4>{getText(label)}</h4>}
{label && <h4>{onlyText(label)}</h4>}
<p>{help}</p>
</CardBody>
</Card>
Expand Down

1 comment on commit 142edae

@vercel
Copy link

@vercel vercel bot commented on 142edae Apr 1, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.