Files
standardnotes-app-web/app/assets/javascripts/components/AccountMenu/Encryption.tsx
VardanHakobyan adfef38bdc refactor: reviewer's comment
- use Preact's `FunctionalComponent` instead of React's `FC` to keep the app more lightweight
- remove `@node_modules/` from imports
2021-06-15 12:07:03 +04:00

37 lines
1.0 KiB
TypeScript

import { FunctionalComponent } from 'preact';
type Props = {
isEncryptionEnabled: boolean;
notesAndTagsCount: number;
encryptionStatusString: string | undefined;
}
const Encryption: FunctionalComponent<Props> = ({
isEncryptionEnabled,
notesAndTagsCount,
encryptionStatusString
}) => {
const getEncryptionStatusForNotes = () => {
const length = notesAndTagsCount;
return `${length}/${length} notes and tags encrypted`;
};
return (
<div className="sk-panel-section">
<div className="sk-panel-section-title">
Encryption
</div>
{isEncryptionEnabled && (
<div className="sk-panel-section-subtitle info">
{getEncryptionStatusForNotes()}
</div>
)}
<p className="sk-p">
{encryptionStatusString}
</p>
</div>
);
};
export default Encryption;