mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-04-23 09:08:32 +02:00
[WIP] Encryption for secure values (#183)
This commit is contained in:
32
src-web/components/core/DismissibleBanner.tsx
Normal file
32
src-web/components/core/DismissibleBanner.tsx
Normal file
@@ -0,0 +1,32 @@
|
||||
import classNames from 'classnames';
|
||||
import { useKeyValue } from '../../hooks/useKeyValue';
|
||||
import type { BannerProps } from './Banner';
|
||||
import { Banner } from './Banner';
|
||||
import { IconButton } from './IconButton';
|
||||
|
||||
export function DismissibleBanner({
|
||||
children,
|
||||
className,
|
||||
id,
|
||||
...props
|
||||
}: BannerProps & { id: string }) {
|
||||
const { set: setDismissed, value: dismissed } = useKeyValue<boolean>({
|
||||
namespace: 'global',
|
||||
key: ['dismiss-banner', id],
|
||||
fallback: false,
|
||||
});
|
||||
|
||||
if (dismissed) return null;
|
||||
|
||||
return (
|
||||
<Banner className={classNames(className, 'relative pr-8')} {...props}>
|
||||
<IconButton
|
||||
className="!absolute right-0 top-0"
|
||||
icon="x"
|
||||
onClick={() => setDismissed((d) => !d)}
|
||||
title="Dismiss message"
|
||||
/>
|
||||
{children}
|
||||
</Banner>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user