mirror of
https://github.com/plausible/analytics.git
synced 2024-12-25 02:24:55 +03:00
fix with-imported-switch for safari (#4194)
This commit is contained in:
parent
2a529b4eaa
commit
b49bbbc8bb
@ -4,24 +4,30 @@ import * as url from '../../util/url'
|
||||
import { BarsArrowUpIcon } from '@heroicons/react/20/solid'
|
||||
import classNames from "classnames"
|
||||
|
||||
function LinkOrDiv({isLink, target, children}) {
|
||||
if (isLink) {
|
||||
return <Link to={target}>{ children }</Link>
|
||||
} else {
|
||||
return <div>{ children }</div>
|
||||
}
|
||||
}
|
||||
|
||||
export default function WithImportedSwitch({query, info}) {
|
||||
if (info && info.visible) {
|
||||
const {togglable, tooltip_msg} = info
|
||||
const enabled = togglable && query.with_imported
|
||||
const target = url.setQuery('with_imported', (!enabled).toString())
|
||||
|
||||
const linkClass = classNames({
|
||||
const iconClass = classNames("mt-0.5", {
|
||||
"dark:text-gray-300 text-gray-700": enabled,
|
||||
"dark:text-gray-500 text-gray-400": !enabled,
|
||||
"cursor-pointer": togglable,
|
||||
"pointer-events-none": !togglable,
|
||||
})
|
||||
|
||||
return (
|
||||
<div tooltip={tooltip_msg} className="w-4 h-4 mx-2">
|
||||
<Link to={target} className={linkClass}>
|
||||
<BarsArrowUpIcon className="mt-0.5"/>
|
||||
</Link>
|
||||
<LinkOrDiv isLink={togglable} target={target}>
|
||||
<BarsArrowUpIcon className={iconClass}/>
|
||||
</LinkOrDiv>
|
||||
</div>
|
||||
)
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user