1
0
Fork 0

wip(lab): more work on Xray

This commit is contained in:
Joost De Cock 2022-01-29 14:51:13 +01:00
parent 460e970c35
commit 9cb3c53e24
12 changed files with 317 additions and 25 deletions

View file

@ -0,0 +1,57 @@
import XrayIcon from 'shared/components/icons/xray.js'
import { linkClasses, Chevron } from 'shared/components/navigation/primary.js'
import Clear from './clear.js'
import Disable from './disable.js'
import List from './list.js'
const Xray = props => {
return (
<details className='py-1' open>
<summary className={`
flex flex-row gap-4 text-lg
hover:cursor-row-resize
p-2
text-base-content
sm:text-neutral-content
items-center
`}>
<span className="text-secondary-focus mr-4"><XrayIcon /></span>
{props.gist?.xray?.enabled
? (
<>
<span className={`grow ${linkClasses} hover:cursor-resize font-bold uppercase`}>
{props.app.t('settings.xray.title')}
</span>
<Chevron />
</>
) : (
<>
<button
className={`grow ${linkClasses} hover:cursor-resize uppercase font-bold text-left`}
onClick={() => props.updateGist(['xray', 'enabled'], true)}
>
{props.app.t('settings.xray.title')}
</button>
<span className="text-normal text-secondary">
{props.app.t('cfp.thingIsDisabled', { thing: props.app.t('settings.xray.title') })}
</span>
</>
)
}
</summary>
{props.gist?.xray?.enabled && (
<ul className="pl-5 list-inside">
<Disable {...props} />
<Clear {...props} />
{
props.gist?.xray?.parts &&
Object.keys(props.gist.xray.parts).map(partName => <List {...props} partName={partName} />)
}
</ul>
)}
</details>
)
}
export default Xray