Skip to content

Privacy-first password manager with built-in email aliasing. Fully encrypted and self-hostable.

Add generic Card and Label components (#2413)

Leendert de Borstb9bc2c5330c5
diff --git a/apps/web/src/components/attachments/AttachmentViewer.tsx b/apps/web/src/components/attachments/AttachmentViewer.tsx
index 28f54257f..db7bfd6e4 100644
--- a/apps/web/src/components/attachments/AttachmentViewer.tsx
+++ b/apps/web/src/components/attachments/AttachmentViewer.tsx
@@ -1,6 +1,8 @@
import { downloadBytes } from '@aliasvault/client/utilities/FileDownload';
import React from 'react';
+import Card from '@/components/shared/Card';
+
import type { Attachment } from '@aliasvault/models/vault';
type AttachmentViewerProps = {
@@ -29,7 +31,7 @@ const AttachmentViewer: React.FC<AttachmentViewerProps> = ({ attachments }) => {
const visible = attachments.filter(a => !a.IsDeleted);
return (
- <div className="p-4 mb-4 bg-white border border-gray-200 rounded-lg shadow-sm 2xl:col-span-2 dark:border-gray-700 sm:p-6 dark:bg-gray-800">
+ <Card variant="section">
<h3 className="mb-4 text-xl font-semibold dark:text-white">Attachments</h3>
{visible.length > 0 ? (
<div className="overflow-x-auto">
@@ -60,7 +62,7 @@ const AttachmentViewer: React.FC<AttachmentViewerProps> = ({ attachments }) => {
) : (
<p className="text-gray-500 dark:text-gray-400">No attachments available.</p>
)}
- </div>
+ </Card>
);
};
diff --git a/apps/web/src/components/auth/setup/SetupSteps.tsx b/apps/web/src/components/auth/setup/SetupSteps.tsx
index de6a70152..52140607e 100644
--- a/apps/web/src/components/auth/setup/SetupSteps.tsx
+++ b/apps/web/src/components/auth/setup/SetupSteps.tsx
@@ -6,6 +6,7 @@ import { useTranslation } from 'react-i18next';
import GlobalNotificationDisplay from '@/components/alerts/GlobalNotificationDisplay';
import PasswordInputField from '@/components/auth/PasswordInputField';
import EditFormRow from '@/components/forms/EditFormRow';
+import FormLabel from '@/components/shared/FormLabel';
import PasswordStrengthIndicator from '@/components/shared/PasswordStrengthIndicator';
import { useAuth } from '@/context/AuthContext';
import { useNotifications } from '@/context/NotificationContext';
@@ -250,14 +251,14 @@ export const PasswordStep: React.FC<{ onPasswordChange: (password: string) => vo
<div className="space-y-4">
<div>
<div>
- <label htmlFor="password" className="block mb-2 text-sm font-medium text-gray-900 dark:text-white">{t(`${tk}.MasterPasswordLabel`)}</label>
+ <FormLabel htmlFor="password">{t(`${tk}.MasterPasswordLabel`)}</FormLabel>
<PasswordInputField id="password" value={password} onValueChange={onPasswordInput} placeholder={t(`${tk}.MasterPasswordPlaceholder`)} />
</div>
<PasswordStrengthIndicator password={password} />
<div className="mt-4">
- <label htmlFor="confirmPassword" className="block mb-2 text-sm font-medium text-gray-900 dark:text-white">{t(`${tk}.ConfirmMasterPasswordLabel`)}</label>
+ <FormLabel htmlFor="confirmPassword">{t(`${tk}.ConfirmMasterPasswordLabel`)}</FormLabel>
<PasswordInputField id="confirmPassword" value={confirmPassword} onValueChange={onConfirmInput} placeholder={t(`${tk}.ConfirmMasterPasswordPlaceholder`)} />
</div>
{errorMessage.length > 0 && <div className="mt-2 text-sm text-red-600 dark:text-red-400">{errorMessage}</div>}
diff --git a/apps/web/src/components/email/RecentEmails.tsx b/apps/web/src/components/email/RecentEmails.tsx
index 5f53f195b..ea58f39c8 100644
--- a/apps/web/src/components/email/RecentEmails.tsx
+++ b/apps/web/src/components/email/RecentEmails.tsx
@@ -6,6 +6,7 @@ import { useTranslation } from 'react-i18next';
import AlertMessageError from '@/components/alerts/AlertMessageError';
import EmailModal from '@/components/email/EmailModal';
import SkeletonBase from '@/components/loading/SkeletonBase';
+import Card from '@/components/shared/Card';
import { useDb } from '@/context/DbContext';
import { useWebApi } from '@/context/WebApiContext';
import { useEmailDomains } from '@/hooks/useEmailDomains';
@@ -197,7 +198,7 @@ const RecentEmails: React.FC<RecentEmailsProps> = ({ emailAddress }) => {
<>
{emailModalVisible && <EmailModal email={email} onClose={() => setEmailModalVisible(false)} onEmailDeleted={() => void manualRefresh()} />}
- <div className="p-4 mb-4 bg-white border border-gray-200 rounded-lg shadow-sm 2xl:col-span-2 dark:border-gray-700 sm:p-6 dark:bg-gray-800">
+ <Card variant="section">
<div className="flex justify-between">
<div>
<h3 className="mb-4 text-xl font-semibold dark:text-white">{t('components.main.email.recentEmails.EmailSectionTitle')}</h3>
@@ -276,7 +277,7 @@ const RecentEmails: React.FC<RecentEmailsProps> = ({ emailAddress }) => {
)}
</div>
)}
- </div>
+ </Card>
</>
);
};
diff --git a/apps/web/src/components/forms/CopyPasteFormRow.tsx b/apps/web/src/components/forms/CopyPasteFormRow.tsx
index 226b52385..afd700043 100644
--- a/apps/web/src/components/forms/CopyPasteFormRow.tsx
+++ b/apps/web/src/components/forms/CopyPasteFormRow.tsx
@@ -1,5 +1,6 @@
import React from 'react';
+import FormLabel from '@/components/shared/FormLabel';
import { useClipboardCopy } from '@/hooks/useClipboardCopy';
type CopyPasteFormRowProps = {
@@ -17,7 +18,7 @@ const CopyPasteFormRow: React.FC<CopyPasteFormRowProps> = ({ id, label = null, v
return (
<>
{label !== null && label !== '' && (
- <label htmlFor={id} className="block mb-2 text-sm font-medium text-gray-900 dark:text-white">{label}</label>
+ <FormLabel htmlFor={id}>{label}</FormLabel>
)}
<div className="relative flex-grow">
<input type="text" autoComplete="off" id={id} className={`outline-0 shadow-sm bg-gray-50 border ${copied ? 'border-green-500 border-2' : 'border-gray-300'} text-gray-900 sm:text-sm rounded-lg block w-full p-2.5 pr-10 dark:bg-gray-700 ${copied ? 'dark:border-green-500' : 'dark:border-gray-600'} dark:placeholder-gray-400 dark:text-white`} value={value} onClick={() => void copyToClipboard(value)} readOnly />
diff --git a/apps/web/src/components/forms/CopyPastePasswordFormRow.tsx b/apps/web/src/components/forms/CopyPastePasswordFormRow.tsx
index 54c5a73a9..49abfdf65 100644
--- a/apps/web/src/components/forms/CopyPastePasswordFormRow.tsx
+++ b/apps/web/src/components/forms/CopyPastePasswordFormRow.tsx
@@ -1,5 +1,6 @@
import React, { useState } from 'react';
+import FormLabel from '@/components/shared/FormLabel';
import { useClipboardCopy } from '@/hooks/useClipboardCopy';
type CopyPastePasswordFormRowProps = {
@@ -18,7 +19,7 @@ const CopyPastePasswordFormRow: React.FC<CopyPastePasswordFormRowProps> = ({ id,
return (
<>
- {label !== '' && <label htmlFor={id} className="block mb-2 text-sm font-medium text-gray-900 dark:text-white">{label}</label>}
+ {label !== '' && <FormLabel htmlFor={id}>{label}</FormLabel>}
<div className="relative">
{isPasswordVisible ? (
<div id={id} className={`outline-0 shadow-sm bg-gray-50 border ${borderClasses} text-gray-900 sm:text-sm rounded-lg block w-full p-2.5 pr-20 min-h-[42px] break-all cursor-pointer dark:bg-gray-700 dark:text-white`} onClick={() => void copyToClipboard(value)}>{value}</div>
diff --git a/apps/web/src/components/forms/EditFormRow.tsx b/apps/web/src/components/forms/EditFormRow.tsx
index 695e4afd3..a4340457b 100644
--- a/apps/web/src/components/forms/EditFormRow.tsx
+++ b/apps/web/src/components/forms/EditFormRow.tsx
@@ -1,5 +1,7 @@
import React from 'react';
+import FormLabel from '@/components/shared/FormLabel';
+
type EditFormRowProps = {
id: string;
label: string;
@@ -21,7 +23,7 @@ const EditFormRow: React.FC<EditFormRowProps> = ({ id, label, type = 'text', val
<>
{labelStyle === 'header'
? <label htmlFor={id} className="mb-4 text-xl font-semibold dark:text-white block">{label}</label>
- : <label htmlFor={id} className="block mb-2 text-sm font-medium text-gray-900 dark:text-white">{label}</label>}
+ : <FormLabel htmlFor={id}>{label}</FormLabel>}
<div className="relative">
{type === 'textarea' ? (
<textarea id={id} style={{ height: '200px' }} className={EDIT_INPUT_CLASSES} value={value} onChange={e => onChange(e.target.value)} placeholder={placeholder} autoCapitalize="off" autoCorrect="off"></textarea>
diff --git a/apps/web/src/components/forms/EditPasswordFormRow.tsx b/apps/web/src/components/forms/EditPasswordFormRow.tsx
index 8de6ba086..aa337cc9a 100644
--- a/apps/web/src/components/forms/EditPasswordFormRow.tsx
+++ b/apps/web/src/components/forms/EditPasswordFormRow.tsx
@@ -5,6 +5,7 @@ import React, { useEffect, useState } from 'react';
import { useTranslation } from 'react-i18next';
import PasswordSettingsPopup from '@/components/settings/PasswordSettingsPopup';
+import FormLabel from '@/components/shared/FormLabel';
import { useDb } from '@/context/DbContext';
import type { PasswordSettings } from '@aliasvault/models/vault';
@@ -70,7 +71,7 @@ const EditPasswordFormRow: React.FC<EditPasswordFormRowProps> = ({ id, label, va
return (
<>
- <label htmlFor={id} className="block mb-2 text-sm font-medium text-gray-900 dark:text-white">{label}</label>
+ <FormLabel htmlFor={id}>{label}</FormLabel>
<div className="flex">
<div className="relative flex-grow">
<input type={isVisible ? 'text' : 'password'} id={id} autoComplete="off" className="outline-0 shadow-sm bg-gray-50 border border-gray-300 text-gray-900 sm:text-sm rounded-l-lg block w-full p-2.5 pr-16 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white" value={value} onChange={e => onChange(e.target.value)} placeholder={placeholder} />
diff --git a/apps/web/src/components/forms/EditUsernameFormRow.tsx b/apps/web/src/components/forms/EditUsernameFormRow.tsx
index e6f0d07e3..1c2040382 100644
--- a/apps/web/src/components/forms/EditUsernameFormRow.tsx
+++ b/apps/web/src/components/forms/EditUsernameFormRow.tsx
@@ -1,5 +1,7 @@
import React from 'react';
+import FormLabel from '@/components/shared/FormLabel';
+
type EditUsernameFormRowProps = {
id: string;
label: string;
@@ -14,7 +16,7 @@ type EditUsernameFormRowProps = {
*/
const EditUsernameFormRow: React.FC<EditUsernameFormRowProps> = ({ id, label, value, onChange, onGenerateNewUsername, placeholder = '' }) => (
<>
- <label htmlFor={id} className="block mb-2 text-sm font-medium text-gray-900 dark:text-white">{label}</label>
+ <FormLabel htmlFor={id}>{label}</FormLabel>
<div className="flex">
<div className="relative flex-grow">
<input type="text" id={id} autoComplete="off" className="outline-0 shadow-sm bg-gray-50 border border-gray-300 text-gray-900 sm:text-sm rounded-l-lg block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white" value={value} onChange={e => onChange(e.target.value)} placeholder={placeholder} />
diff --git a/apps/web/src/components/forms/MultiValueFormRow.tsx b/apps/web/src/components/forms/MultiValueFormRow.tsx
index c1337d86b..538d18ec6 100644
--- a/apps/web/src/components/forms/MultiValueFormRow.tsx
+++ b/apps/web/src/components/forms/MultiValueFormRow.tsx
@@ -1,6 +1,7 @@
import React from 'react';
import { EDIT_INPUT_CLASSES } from '@/components/forms/EditFormRow';
+import FormLabel from '@/components/shared/FormLabel';
type MultiValueFormRowProps = {
id: string;
@@ -19,7 +20,7 @@ const MultiValueFormRow: React.FC<MultiValueFormRowProps> = ({ id, label, values
return (
<>
- <label htmlFor={id} className="block mb-2 text-sm font-medium text-gray-900 dark:text-white">{label}</label>
+ <FormLabel htmlFor={id}>{label}</FormLabel>
<div className="space-y-2">
{shown.map((value, index) => (
<div key={index} className="relative">
diff --git a/apps/web/src/components/forms/RemovableSection.tsx b/apps/web/src/components/forms/RemovableSection.tsx
index dc9ad51bd..ae3f76423 100644
--- a/apps/web/src/components/forms/RemovableSection.tsx
+++ b/apps/web/src/components/forms/RemovableSection.tsx
@@ -1,6 +1,8 @@
import React from 'react';
import { useTranslation } from 'react-i18next';
+import Card from '@/components/shared/Card';
+
type RemovableSectionProps = {
title?: string;
canRemove: boolean;
@@ -15,7 +17,7 @@ const RemovableSection: React.FC<RemovableSectionProps> = ({ title = '', canRemo
const { t } = useTranslation();
return (
- <div className="p-4 mb-4 bg-white border border-gray-200 rounded-lg shadow-sm 2xl:col-span-2 dark:border-gray-700 sm:p-6 dark:bg-gray-800 relative">
+ <Card variant="section" className="relative">
{title.length > 0 && <h3 className="mb-4 text-xl font-semibold dark:text-white">{title}</h3>}
<div className="grid gap-6">
{children}
@@ -27,7 +29,7 @@ const RemovableSection: React.FC<RemovableSectionProps> = ({ title = '', canRemo
</svg>
</button>
)}
- </div>
+ </Card>
);
};
diff --git a/apps/web/src/components/items/FieldBlock.tsx b/apps/web/src/components/items/FieldBlock.tsx
index a12954db1..bb7175ce9 100644
--- a/apps/web/src/components/items/FieldBlock.tsx
+++ b/apps/web/src/components/items/FieldBlock.tsx
@@ -6,6 +6,7 @@ import CopyPasteFormRow from '@/components/forms/CopyPasteFormRow';
import CopyPastePasswordFormRow from '@/components/forms/CopyPastePasswordFormRow';
import type { DisplayField } from '@/components/items/DisplayField';
import FieldHistoryModal from '@/components/items/FieldHistoryModal';
+import FormLabel from '@/components/shared/FormLabel';
import { useDb } from '@/context/DbContext';
import type { ItemRef } from '@aliasvault/client/database/ItemRef';
@@ -92,7 +93,7 @@ const FieldBlock: React.FC<FieldBlockProps> = ({ field, item, fullWidth = false,
}, [dbContext.sqliteClient, field.EnableHistory, field.FieldKey, field.Value, item.Id, item.ManifestId, showHistoryModal]);
const labelElement = (
- <label htmlFor={fieldId} className="block mb-2 text-sm font-medium text-gray-900 dark:text-white">
+ <FormLabel htmlFor={fieldId}>
{label}
{field.EnableHistory && historyCount > 0 && (
<button type="button" className="ml-2 inline-flex items-center text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200 focus:outline-none" title={t('components.fields.fieldBlock.ViewHistory')} onClick={() => setShowHistoryModal(true)}>
@@ -101,7 +102,7 @@ const FieldBlock: React.FC<FieldBlockProps> = ({ field, item, fullWidth = false,
</svg>
</button>
)}
- </label>
+ </FormLabel>
);
/**
diff --git a/apps/web/src/components/layout/CreateNewIdentityWidget.tsx b/apps/web/src/components/layout/CreateNewIdentityWidget.tsx
index 4079876da..5736b556b 100644
--- a/apps/web/src/components/layout/CreateNewIdentityWidget.tsx
+++ b/apps/web/src/components/layout/CreateNewIdentityWidget.tsx
@@ -3,6 +3,7 @@ import React, { useCallback, useEffect, useRef, useState } from 'react';
import { useTranslation } from 'react-i18next';
import { useLocation, useNavigate } from 'react-router-dom';
+import FormLabel from '@/components/shared/FormLabel';
import { useDb } from '@/context/DbContext';
import { useLoading } from '@/context/LoadingContext';
import { useNotifications } from '@/context/NotificationContext';
@@ -214,7 +215,7 @@ const CreateNewIdentityWidget: React.FC = () => {
<h3 className="text-lg font-semibold mb-4 text-gray-900 dark:text-white">{getPopupTitle()}</h3>
<form onSubmit={handleSubmit}>
<div className="mb-4">
- <label htmlFor="serviceName" className="block mb-2 text-sm font-medium text-gray-900 dark:text-white">{t('components.main.widgets.createNewIdentityWidget.NameLabel')}</label>
+ <FormLabel htmlFor="serviceName">{t('components.main.widgets.createNewIdentityWidget.NameLabel')}</FormLabel>
<input
ref={nameInputRef}
id="serviceName"
@@ -229,7 +230,7 @@ const CreateNewIdentityWidget: React.FC = () => {
</div>
{(itemType === ItemTypes.Login || itemType === ItemTypes.Alias) && (
<div className="mb-4">
- <label htmlFor="serviceUrl" className="block mb-2 text-sm font-medium text-gray-900 dark:text-white">{t('components.main.widgets.createNewIdentityWidget.WebsiteUrlLabel')}</label>
+ <FormLabel htmlFor="serviceUrl">{t('components.main.widgets.createNewIdentityWidget.WebsiteUrlLabel')}</FormLabel>
<input
id="serviceUrl"
type="text"
diff --git a/apps/web/src/components/settings/DefaultPasswordSettings.tsx b/apps/web/src/components/settings/DefaultPasswordSettings.tsx
index a1211e763..acfbb1617 100644
--- a/apps/web/src/components/settings/DefaultPasswordSettings.tsx
+++ b/apps/web/src/components/settings/DefaultPasswordSettings.tsx
@@ -2,6 +2,7 @@ import React, { useEffect, useState } from 'react';
import { useTranslation } from 'react-i18next';
import PasswordSettingsPopup from '@/components/settings/PasswordSettingsPopup';
+import FormLabel from '@/components/shared/FormLabel';
import { useDb } from '@/context/DbContext';
import type { PasswordSettings } from '@aliasvault/models/vault';
@@ -22,7 +23,7 @@ const DefaultPasswordSettings: React.FC = () => {
return (
<div className="mb-4">
- <label htmlFor="password-generator-settings-modal" className="block mb-2 text-sm font-medium text-gray-900 dark:text-white">{t(`${tk}.PasswordGeneratorSettingsLabel`)}</label>
+ <FormLabel htmlFor="password-generator-settings-modal">{t(`${tk}.PasswordGeneratorSettingsLabel`)}</FormLabel>
<button type="button" id="password-generator-settings-modal" className="px-4 py-2 bg-primary-600 text-white rounded-md hover:bg-primary-700 focus:outline-none focus:ring-2 focus:ring-primary-500 dark:bg-primary-700 dark:hover:bg-primary-600" onClick={() => setIsVisible(true)}>
{t(`${tk}.ConfigureButton`)}
</button>
diff --git a/apps/web/src/components/settings/security/SecuritySection.tsx b/apps/web/src/components/settings/security/SecuritySection.tsx
index ddeac83d7..5fbc39ce2 100644
--- a/apps/web/src/components/settings/security/SecuritySection.tsx
+++ b/apps/web/src/components/settings/security/SecuritySection.tsx
@@ -1,5 +1,7 @@
import React from 'react';
+import Card from '@/components/shared/Card';
+
/**
* What the security page can ask a section to do.
*/
@@ -17,10 +19,10 @@ export const formatDateTime = (value: string): string => new Date(value).toLocal
* Card holding one section of the security settings page.
*/
const SecuritySection: React.FC<{ title: string; children: React.ReactNode }> = ({ title, children }) => (
- <div className="p-4 mb-4 mx-4 bg-white border border-gray-200 rounded-lg shadow-sm dark:border-gray-700 sm:p-6 dark:bg-gray-800">
+ <Card>
<h3 className="mb-2 text-lg font-medium text-gray-900 dark:text-white">{title}</h3>
{children}
- </div>
+ </Card>
);
export default SecuritySection;
diff --git a/apps/web/src/components/shared/Card.tsx b/apps/web/src/components/shared/Card.tsx
new file mode 100644
index 000000000..8b10e8ad7
--- /dev/null
+++ b/apps/web/src/components/shared/Card.tsx
@@ -0,0 +1,29 @@
+import React from 'react';
+
+/** Card layouts: `page` for settings pages (side margin), `section` for item page grids, `plain` for neither. */
+export type CardVariant = 'page' | 'section' | 'plain';
+
+type CardProps = {
+ children: React.ReactNode;
+ variant?: CardVariant;
+ className?: string;
+};
+
+const BASE_CLASSES = 'p-4 mb-4 bg-white border border-gray-200 rounded-lg shadow-sm dark:border-gray-700 sm:p-6 dark:bg-gray-800';
+
+const VARIANT_CLASSES: Record<CardVariant, string> = {
+ page: 'mx-4',
+ section: '2xl:col-span-2',
+ plain: '',
+};
+
+/**
+ * White bordered card that groups page content.
+ */
+const Card: React.FC<CardProps> = ({ children, variant = 'page', className = '' }) => (
+ <div className={`${BASE_CLASSES} ${VARIANT_CLASSES[variant]} ${className}`.trim()}>
+ {children}
+ </div>
+);
+
+export default Card;
diff --git a/apps/web/src/components/shared/FormLabel.tsx b/apps/web/src/components/shared/FormLabel.tsx
new file mode 100644
index 000000000..dabc9f04d
--- /dev/null
+++ b/apps/web/src/components/shared/FormLabel.tsx
@@ -0,0 +1,15 @@
+import React from 'react';
+
+type FormLabelProps = {
+ children: React.ReactNode;
+ htmlFor?: string;
+};
+
+/**
+ * Label above a form field.
+ */
+const FormLabel: React.FC<FormLabelProps> = ({ children, htmlFor }) => (
+ <label htmlFor={htmlFor} className="block mb-2 text-sm font-medium text-gray-900 dark:text-white">{children}</label>
+);
+
+export default FormLabel;
diff --git a/apps/web/src/components/auth/InputTextField.tsx b/apps/web/src/components/shared/InputTextField.tsx
similarity index 95%
rename from apps/web/src/components/auth/InputTextField.tsx
rename to apps/web/src/components/shared/InputTextField.tsx
index be9b552ff..0980a17a5 100644
--- a/apps/web/src/components/auth/InputTextField.tsx
+++ b/apps/web/src/components/shared/InputTextField.tsx
@@ -7,7 +7,7 @@ type InputTextFieldProps = Omit<React.InputHTMLAttributes<HTMLInputElement>, 'on
};
/**
- * Text input with the auth form styling.
+ * Text input with the form styling.
*/
const InputTextField = forwardRef<HTMLInputElement, InputTextFieldProps>(({ id, value, onValueChange, ...rest }, ref) => (
<input
diff --git a/apps/web/src/components/shared/Select.tsx b/apps/web/src/components/shared/Select.tsx
new file mode 100644
index 000000000..7efe62e27
--- /dev/null
+++ b/apps/web/src/components/shared/Select.tsx
@@ -0,0 +1,12 @@
+import React from 'react';
+
+/**
+ * Full width select with the form styling.
+ */
+const Select: React.FC<React.SelectHTMLAttributes<HTMLSelectElement>> = ({ children, ...rest }) => (
+ <select className="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500" {...rest}>
+ {children}
+ </select>
+);
+
+export default Select;
diff --git a/apps/web/src/components/totp/TotpCodes.tsx b/apps/web/src/components/totp/TotpCodes.tsx
index 5fe03d4b2..f13ca60ab 100644
--- a/apps/web/src/components/totp/TotpCodes.tsx
+++ b/apps/web/src/components/totp/TotpCodes.tsx
@@ -4,6 +4,8 @@ import QRCode from 'qrcode';
import React, { useEffect, useRef, useState } from 'react';
import { useTranslation } from 'react-i18next';
+import Card from '@/components/shared/Card';
+import FormLabel from '@/components/shared/FormLabel';
import FormModal from '@/components/shared/FormModal';
import { useConfirmModal } from '@/context/ConfirmModalContext';
import { useNotifications } from '@/context/NotificationContext';
@@ -162,7 +164,7 @@ const TotpCodes: React.FC<TotpCodesProps> = ({ totpCodes, onTotpCodesChange, can
return (
<>
- <div className="p-4 mb-4 bg-white border border-gray-200 rounded-lg shadow-sm 2xl:col-span-2 dark:border-gray-700 sm:p-6 dark:bg-gray-800 relative">
+ <Card variant="section" className="relative">
<div className="flex justify-between items-start">
<div>
<h3 className="text-xl font-semibold dark:text-white">{t(`${tk}.TwoFactorAuthenticationTitle`)}</h3>
@@ -206,7 +208,7 @@ const TotpCodes: React.FC<TotpCodesProps> = ({ totpCodes, onTotpCodesChange, can
</div>
<p className="mb-4 text-sm text-gray-500 dark:text-gray-400">{t(`${tk}.TotpInstructions`)}</p>
<div className="mb-4">
- <label htmlFor="totp-secret" className="block mb-2 text-sm font-medium text-gray-900 dark:text-white">{t(`${tk}.SecretKeyLabel`)}</label>
+ <FormLabel htmlFor="totp-secret">{t(`${tk}.SecretKeyLabel`)}</FormLabel>
<input id="totp-secret" type="text" value={newSecret} onChange={(e) => {
setNewSecret(e.target.value);
setSecretError('');
@@ -266,7 +268,7 @@ const TotpCodes: React.FC<TotpCodesProps> = ({ totpCodes, onTotpCodesChange, can
</div>
))}
</div>
- </div>
+ </Card>
<FormModal isOpen={editingCode !== null} title={t('sharedResources.Edit')} showDefaultFooter={false} maxWidth="lg" onClose={() => setEditingCode(null)} submitOnEnter={false}>
<div className="space-y-4">
diff --git a/apps/web/src/components/totp/TotpViewer.tsx b/apps/web/src/components/totp/TotpViewer.tsx
index c46bede7f..2ae6d0742 100644
--- a/apps/web/src/components/totp/TotpViewer.tsx
+++ b/apps/web/src/components/totp/TotpViewer.tsx
@@ -3,6 +3,7 @@ import { normalizeTotpPeriod, type TotpCode } from '@aliasvault/models/vault';
import React, { useEffect, useState } from 'react';
import { useTranslation } from 'react-i18next';
+import Card from '@/components/shared/Card';
import { useClipboardCopy } from '@/hooks/useClipboardCopy';
type TotpViewerProps = {
@@ -65,7 +66,7 @@ const TotpViewer: React.FC<TotpViewerProps> = ({ totpCodes }) => {
}, []);
return (
- <div className="p-4 mb-4 bg-white border border-gray-200 rounded-lg shadow-sm 2xl:col-span-2 dark:border-gray-700 sm:p-6 dark:bg-gray-800">
+ <Card variant="section">
<div className="flex justify-between">
<div>
<h3 className="mb-4 text-xl font-semibold dark:text-white">{t('components.main.components.totpCodes.totpViewer.TwoFactorAuthenticationTitle')}</h3>
@@ -81,7 +82,7 @@ const TotpViewer: React.FC<TotpViewerProps> = ({ totpCodes }) => {
{totpCodes.map(totpCode => <TotpRow key={totpCode.Id} totpCode={totpCode} tick={tick} />)}
</div>
)}
- </div>
+ </Card>
);
};
diff --git a/apps/web/src/pages/auth/Login.tsx b/apps/web/src/pages/auth/Login.tsx
index 226137a1a..7c08822fa 100644
--- a/apps/web/src/pages/auth/Login.tsx
+++ b/apps/web/src/pages/auth/Login.tsx
@@ -11,9 +11,10 @@ import { useTranslation } from 'react-i18next';
import { Link, useNavigate } from 'react-router-dom';
import ServerValidationErrors from '@/components/alerts/ServerValidationErrors';
-import InputTextField from '@/components/auth/InputTextField';
import PasswordInputField from '@/components/auth/PasswordInputField';
import FooterLogin from '@/components/layout/FooterLogin';
+import FormLabel from '@/components/shared/FormLabel';
+import InputTextField from '@/components/shared/InputTextField';
import { getAppConfig } from '@/config/AppConfig';
import { useAuth } from '@/context/AuthContext';
import { useLoading } from '@/context/LoadingContext';
@@ -224,7 +225,7 @@ const Login: React.FC = () => {
<div className="w-full">
<form onSubmit={handle2Fa} className="space-y-6" av-enable="true" av-suppress-save="true">
<div>
- <label htmlFor="two-factor-code" className="block mb-2 text-sm font-medium text-gray-900 dark:text-white">{t('components.auth.login.AuthenticatorCodeLabel')}</label>
+ <FormLabel htmlFor="two-factor-code">{t('components.auth.login.AuthenticatorCodeLabel')}</FormLabel>
<input ref={twoFactorRef} id="two-factor-code" type="number" value={twoFactorCode} onChange={(e) => setTwoFactorCode(e.target.value)} className={inputClass} autoComplete="one-time-code" />
</div>
<div className="flex items-start">
@@ -266,7 +267,7 @@ const Login: React.FC = () => {
<div className="w-full">
<form onSubmit={handleRecoveryCode} className="space-y-6">
<div>
- <label htmlFor="recovery-code" className="block mb-2 text-sm font-medium text-gray-900 dark:text-white">{t('components.auth.login.RecoveryCodeLabel')}</label>
+ <FormLabel htmlFor="recovery-code">{t('components.auth.login.RecoveryCodeLabel')}</FormLabel>
<input id="recovery-code" type="text" value={recoveryCode} onChange={(e) => setRecoveryCode(e.target.value)} className={inputClass} autoComplete="off" />
</div>
<button type="submit" className={submitClass}>{t('components.auth.login.LoginButton')}</button>
@@ -294,11 +295,11 @@ const Login: React.FC = () => {
<form onSubmit={handleLogin} className="mt-4 space-y-6" av-enable="true" av-suppress-save="true">
<ServerValidationErrors errors={errors} />
<div>
- <label htmlFor="email" className="block mb-2 text-sm font-medium text-gray-900 dark:text-white">{t('components.auth.login.UsernameOrEmailLabel')}</label>
+ <FormLabel htmlFor="email">{t('components.auth.login.UsernameOrEmailLabel')}</FormLabel>
<InputTextField ref={usernameRef} id="email" value={username} onValueChange={setUsername} type="text" placeholder={t('components.auth.login.UsernamePlaceholder')} autoCapitalize="off" autoCorrect="off" required />
</div>
<div>
- <label htmlFor="password" className="block mb-2 text-sm font-medium text-gray-900 dark:text-white">{t('components.auth.login.PasswordLabel')}</label>
+ <FormLabel htmlFor="password">{t('components.auth.login.PasswordLabel')}</FormLabel>
<PasswordInputField id="password" value={password} onValueChange={setPassword} placeholder={t('components.auth.login.PasswordPlaceholder')} />
</div>
diff --git a/apps/web/src/pages/auth/Unlock.tsx b/apps/web/src/pages/auth/Unlock.tsx
index f8690d7b3..5bfaec148 100644
--- a/apps/web/src/pages/auth/Unlock.tsx
+++ b/apps/web/src/pages/auth/Unlock.tsx
@@ -12,6 +12,7 @@ import ServerValidationErrors from '@/components/alerts/ServerValidationErrors';
import PasswordInputField from '@/components/auth/PasswordInputField';
import FooterLogin from '@/components/layout/FooterLogin';
import BoldLoadingIndicator from '@/components/loading/BoldLoadingIndicator';
+import FormLabel from '@/components/shared/FormLabel';
import { useAuth } from '@/context/AuthContext';
import { useDb } from '@/context/DbContext';
import { useLoading } from '@/context/LoadingContext';
@@ -232,7 +233,7 @@ const Unlock: React.FC = () => {
<form onSubmit={unlockSubmit} className="mt-4 space-y-6" av-enable="true" av-suppress-save="true">
<div>
- <label htmlFor="password" className="block mb-2 text-sm font-medium text-gray-900 dark:text-white">{t('pages.auth.unlock.YourPasswordLabel')}</label>
+ <FormLabel htmlFor="password">{t('pages.auth.unlock.YourPasswordLabel')}</FormLabel>
<PasswordInputField ref={passwordRef} id="password" value={password} onValueChange={setPassword} placeholder="••••••••" />
</div>
diff --git a/apps/web/src/pages/items/AddEdit.tsx b/apps/web/src/pages/items/AddEdit.tsx
index e540caeba..e1c2de8d2 100644
--- a/apps/web/src/pages/items/AddEdit.tsx
+++ b/apps/web/src/pages/items/AddEdit.tsx
@@ -18,6 +18,7 @@ import ItemTypeSelector from '@/components/items/ItemTypeSelector';
import LoadingIndicator from '@/components/loading/LoadingIndicator';
import type { BreadcrumbItem } from '@/components/shared/Breadcrumb';
import Button from '@/components/shared/Button';
+import Card from '@/components/shared/Card';
import PageContent from '@/components/shared/PageContent';
import PageHeader from '@/components/shared/PageHeader';
import StickyActionBar from '@/components/shared/StickyActionBar';
@@ -41,12 +42,12 @@ const MIN_SAVE_INDICATOR_MS = 250;
* A card section on the form.
*/
const Section: React.FC<{ title?: React.ReactNode; children: React.ReactNode; className?: string }> = ({ title, children, className = '' }) => (
- <div className={`p-4 mb-4 bg-white border border-gray-200 rounded-lg shadow-sm 2xl:col-span-2 dark:border-gray-700 sm:p-6 dark:bg-gray-800 ${className}`}>
+ <Card variant="section" className={className}>
{title && <h3 className="mb-4 text-xl font-semibold dark:text-white flex items-center gap-2">{title}</h3>}
<div className="grid gap-6">
{children}
</div>
- </div>
+ </Card>
);
/**
@@ -623,7 +624,7 @@ const ItemAddEdit: React.FC = () => {
{edit.ItemType === ItemTypes.Alias && (
<div className="col-span-1 md:col-span-1 lg:col-span-2">
- <div className="p-4 mb-4 bg-white border border-gray-200 rounded-lg shadow-sm 2xl:col-span-2 dark:border-gray-700 sm:p-6 dark:bg-gray-800">
+ <Card variant="section">
<h3 className="mb-4 text-xl font-semibold dark:text-white flex items-center justify-between gap-2">
<span>{t(`${tk}.AliasSectionHeader`)}</span>
<button type="button" id="generate-random-alias" onClick={() => void onGenerateRandomAlias()} className="p-1.5 text-gray-400 hover:text-primary-500 transition-colors focus:outline-none" title={t('sharedResources.Generate')}>
@@ -639,7 +640,7 @@ const ItemAddEdit: React.FC = () => {
<div className="col-span-6 sm:col-span-3">{textField(FieldKey.AliasGender, 'gender', t(`${tk}.GenderLabel`))}</div>
<div className="col-span-6 sm:col-span-3">{textField(FieldKey.AliasBirthdate, 'birthdate', t(`${tk}.BirthDateLabel`))}</div>
</div>
- </div>
+ </Card>
</div>
)}
@@ -679,7 +680,7 @@ const ItemAddEdit: React.FC = () => {
{customFields.length > 0 && (
<div className="col-span-1 md:col-span-1 lg:col-span-2">
- <div className="p-4 mb-4 bg-white border border-gray-200 rounded-lg shadow-sm 2xl:col-span-2 dark:border-gray-700 sm:p-6 dark:bg-gray-800">
+ <Card variant="section">
<h3 className="mb-4 text-xl font-semibold dark:text-white">{t(`${tk}.CustomFieldsSectionHeader`)}</h3>
<DraggableCustomFieldsList
customFields={customFields}
@@ -688,7 +689,7 @@ const ItemAddEdit: React.FC = () => {
onFieldUpdate={(fieldKey, label, fieldType) => update(current => updateCustomField(current, fieldKey, label, fieldType))}
onDelete={fieldKey => update(current => removeCustomField(current, fieldKey))}
/>
- </div>
+ </Card>
</div>
)}
diff --git a/apps/web/src/pages/items/Home.tsx b/apps/web/src/pages/items/Home.tsx
index 8422359a4..34d921304 100644
--- a/apps/web/src/pages/items/Home.tsx
+++ b/apps/web/src/pages/items/Home.tsx
@@ -16,9 +16,11 @@ import { type ItemListEntry, toItemListEntry } from '@/components/items/ItemList
import ItemsTable from '@/components/items/ItemsTable';
import LoadingIndicator from '@/components/loading/LoadingIndicator';
import type { BreadcrumbItem } from '@/components/shared/Breadcrumb';
+import FormLabel from '@/components/shared/FormLabel';
import PageContent from '@/components/shared/PageContent';
import PageHeader from '@/components/shared/PageHeader';
import RefreshButton from '@/components/shared/RefreshButton';
+import Select from '@/components/shared/Select';
import type { SortDirection } from '@/components/shared/SortableTable';
import { useDb } from '@/context/DbContext';
import { useNotifications } from '@/context/NotificationContext';
@@ -416,8 +418,6 @@ const ItemsHome: React.FC = () => {
}
};
- const selectClass = 'bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500';
-
return (
<>
<PageHeader
@@ -464,23 +464,23 @@ const ItemsHome: React.FC = () => {
<div ref={settingsDropdownRef} id="settingsDropdown" className="absolute right-0 z-10 mt-2 min-w-[220px] origin-top-right rounded-md bg-white shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none dark:bg-gray-700">
<div className="p-4">
<div className="mb-4">
- <label className="block mb-2 text-sm font-medium text-gray-900 dark:text-white">{t('pages.main.items.home.ViewModeLabel')}</label>
- <select value={viewMode} onChange={(e) => {
+ <FormLabel>{t('pages.main.items.home.ViewModeLabel')}</FormLabel>
+ <Select value={viewMode} onChange={(e) => {
setViewMode(e.target.value as ViewMode); closeSettingsPopup();
- }} className={selectClass}>
+ }}>
<option value="grid">{t('pages.main.items.home.GridViewOption')}</option>
<option value="table">{t('pages.main.items.home.TableViewOption')}</option>
- </select>
+ </Select>
</div>
<div className="mb-4">
- <label className="block mb-2 text-sm font-medium text-gray-900 dark:text-white">{t('pages.main.items.home.SortOrderLabel')}</label>
- <select value={sortOrder} onChange={(e) => {
+ <FormLabel>{t('pages.main.items.home.SortOrderLabel')}</FormLabel>
+ <Select value={sortOrder} onChange={(e) => {
setSortOrder(e.target.value as CredentialSortOrder); closeSettingsPopup();
- }} className={selectClass}>
+ }}>
<option value={CredentialSortOrder.OldestFirst}>{t('pages.main.items.home.OldestFirstOption')}</option>
<option value={CredentialSortOrder.NewestFirst}>{t('pages.main.items.home.NewestFirstOption')}</option>
<option value={CredentialSortOrder.Alphabetical}>{t('pages.main.items.home.AlphabeticalOption')}</option>
- </select>
+ </Select>
</div>
</div>
</div>
diff --git a/apps/web/src/pages/items/View.tsx b/apps/web/src/pages/items/View.tsx
index aba1d0800..99c3bcf0f 100644
--- a/apps/web/src/pages/items/View.tsx
+++ b/apps/web/src/pages/items/View.tsx
@@ -13,6 +13,7 @@ import ItemIcon from '@/components/items/ItemIcon';
import LoadingIndicator from '@/components/loading/LoadingIndicator';
import type { BreadcrumbItem } from '@/components/shared/Breadcrumb';
import Button from '@/components/shared/Button';
+import Card from '@/components/shared/Card';
import FormModal from '@/components/shared/FormModal';
import LinkButton from '@/components/shared/LinkButton';
import PageContent from '@/components/shared/PageContent';
@@ -33,10 +34,10 @@ import type { Folder } from '@aliasvault/client/database/repositories/FolderRepo
* A card section on the item page.
*/
const Section: React.FC<{ title?: string; children: React.ReactNode }> = ({ title, children }) => (
- <div className="p-4 mb-4 bg-white border border-gray-200 rounded-lg shadow-sm 2xl:col-span-2 dark:border-gray-700 sm:p-6 dark:bg-gray-800">
+ <Card variant="section">
{title && <h3 className="mb-4 text-xl font-semibold dark:text-white">{title}</h3>}
{children}
- </div>
+ </Card>
);
/**
@@ -221,7 +222,7 @@ const ItemView: React.FC = () => {
<div className="col-span-1 md:col-span-2 lg:col-span-2">
{isLoginLike && loginFields.length > 0 && (
- <div className="p-4 mb-4 bg-white border border-gray-200 rounded-lg shadow-sm 2xl:col-span-2 dark:border-gray-700 sm:p-6 dark:bg-gray-800">
+ <Card variant="section">
<h3 className="mb-2 text-xl font-semibold dark:text-white">{t('pages.main.items.view.LoginDetailsSection')}</h3>
<p className="mb-4 text-sm text-gray-600 dark:text-gray-400">
<span>{domains.isAliasVaultSupportedDomain(emailAddress) ? t('pages.main.items.view.GeneratedItemDescription') : t('pages.main.items.view.StoredItemDescription')}</span>
@@ -258,7 +259,7 @@ const ItemView: React.FC = () => {
)}
<FieldGrid fields={loginFields} item={item} fullWidth={f => shouldBeFullWidth(f, loginFields)} />
- </div>
+ </Card>
)}
{item.ItemType === ItemTypes.Alias && aliasFields.length > 0 && (
diff --git a/apps/web/src/pages/settings/Apps.tsx b/apps/web/src/pages/settings/Apps.tsx
index 00970b710..b0a4f60a5 100644
--- a/apps/web/src/pages/settings/Apps.tsx
+++ b/apps/web/src/pages/settings/Apps.tsx
@@ -1,6 +1,7 @@
import React from 'react';
import { useTranslation } from 'react-i18next';
+import Card from '@/components/shared/Card';
import PageContent from '@/components/shared/PageContent';
import PageHeader from '@/components/shared/PageHeader';
import { usePageTitle } from '@/hooks/usePageTitle';
@@ -62,7 +63,7 @@ const AppsSettings: React.FC = () => {
<PageHeader breadcrumbItems={[{ displayName: t(`${tk}.BreadcrumbTitle`) }]} title={t(`${tk}.PageTitle`)} description={t(`${tk}.PageDescription`)} />
<PageContent>
- <div className="p-4 mb-4 mx-4 bg-white border border-gray-200 rounded-lg shadow-sm dark:border-gray-700 sm:p-6 dark:bg-gray-800">
+ <Card>
<div className="mb-6">
<h3 className="text-lg font-medium text-gray-900 dark:text-white mb-2">{t(`${tk}.BrowserExtensionsTitle`)}</h3>
<p className="text-gray-600 dark:text-gray-400">{t(`${tk}.BrowserExtensionsDescription`)}</p>
@@ -82,7 +83,7 @@ const AppsSettings: React.FC = () => {
<div className="grid grid-cols-1 lg:grid-cols-2 gap-4">
{MOBILE_APPS.map(app => <AppRow key={app.name} app={app} buttonText={t(`${tk}.DownloadButton`)} comingSoonText={t(`${tk}.ComingSoonText`)} />)}
</div>
- </div>
+ </Card>
</PageContent>
</>
);
diff --git a/apps/web/src/pages/settings/General.tsx b/apps/web/src/pages/settings/General.tsx
index 502ac81f9..61112c751 100644
--- a/apps/web/src/pages/settings/General.tsx
+++ b/apps/web/src/pages/settings/General.tsx
@@ -4,8 +4,11 @@ import React, { useCallback, useEffect, useState } from 'react';
import { useTranslation } from 'react-i18next';
import DefaultPasswordSettings from '@/components/settings/DefaultPasswordSettings';
+import Card from '@/components/shared/Card';
+import FormLabel from '@/components/shared/FormLabel';
import PageContent from '@/components/shared/PageContent';
import PageHeader from '@/components/shared/PageHeader';
+import Select from '@/components/shared/Select';
import { getAppConfig } from '@/config/AppConfig';
import { useDb } from '@/context/DbContext';
import { usePageTitle } from '@/hooks/usePageTitle';
@@ -14,10 +17,6 @@ import { AVAILABLE_LANGUAGES } from '@/i18n/config';
import { changeLanguage } from '@/i18n/i18n';
import { vaultStore } from '@/vault/VaultStore';
-const SELECT_CLASSES = 'bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500';
-const LABEL_CLASSES = 'block mb-2 text-sm font-medium text-gray-900 dark:text-white';
-const CARD_CLASSES = 'p-4 mb-4 mx-4 bg-white border border-gray-200 rounded-lg shadow-sm dark:border-gray-700 sm:p-6 dark:bg-gray-800';
-
/**
* Whether the private domain list holds a usable domain.
*/
@@ -119,25 +118,25 @@ const GeneralSettings: React.FC = () => {
<PageHeader breadcrumbItems={[{ displayName: t(`${tk}.BreadcrumbTitle`) }]} title={t(`${tk}.PageTitle`)} description={t(`${tk}.PageDescription`)} />
<PageContent>
- <div className={CARD_CLASSES}>
+ <Card>
<h3 className="mb-4 text-lg font-medium text-gray-900 dark:text-white">{t(`${tk}.AppLanguageTitle`)}</h3>
<div className="mb-4">
- <label htmlFor="appLanguage" className={LABEL_CLASSES}>{t(`${tk}.AppLanguageLabel`)}</label>
- <select id="appLanguage" value={appLanguage} onChange={e => void updateAppLanguage(e.target.value)} className={SELECT_CLASSES}>
+ <FormLabel htmlFor="appLanguage">{t(`${tk}.AppLanguageLabel`)}</FormLabel>
+ <Select id="appLanguage" value={appLanguage} onChange={e => void updateAppLanguage(e.target.value)}>
{AVAILABLE_LANGUAGES.map(language => <option key={language.code} value={language.code}>{language.flag} {language.nativeName}</option>)}
- </select>
+ </Select>
<span className="block text-sm font-normal text-gray-500 truncate dark:text-gray-400">{t(`${tk}.AppLanguageDescription`)}</span>
</div>
- </div>
+ </Card>
- <div className={CARD_CLASSES}>
+ <Card>
<h3 className="mb-4 text-lg font-medium text-gray-900 dark:text-white">{t(`${tk}.EmailSettingsTitle`)}</h3>
<div className="mb-4">
- <label htmlFor="defaultEmailDomain" className={LABEL_CLASSES}>{t(`${tk}.DefaultEmailDomainLabel`)}</label>
- <select id="defaultEmailDomain" value={defaultEmailDomain} onChange={(e) => {
+ <FormLabel htmlFor="defaultEmailDomain">{t(`${tk}.DefaultEmailDomainLabel`)}</FormLabel>
+ <Select id="defaultEmailDomain" value={defaultEmailDomain} onChange={(e) => {
setDefaultEmailDomain(e.target.value);
void updateSetting('DefaultEmailDomain', e.target.value);
- }} className={SELECT_CLASSES}>
+ }}>
<optgroup label={t(`${tk}.PrivateDomainsLabel`)}>
{hasValidPrivateDomains(privateDomains)
? privateDomains.map(domain => <option key={domain} value={domain}>{domain}</option>)
@@ -146,7 +145,7 @@ const GeneralSettings: React.FC = () => {
<optgroup label={t(`${tk}.PublicDomainsLabel`)}>
{publicDomains.map(domain => <option key={domain} value={domain}>{domain}</option>)}
</optgroup>
- </select>
+ </Select>
<span className="block text-sm font-normal text-gray-500 dark:text-gray-400 mt-2">
{t(`${tk}.DefaultEmailDomainDescription`)} {t(`${tk}.DefaultEmailDomainDescriptionNote`)} <a href="https://docs.aliasvault.com/misc/private-vs-public-email.html" className="text-primary-500 hover:text-primary-700 hover:underline" target="_blank" rel="noopener noreferrer">{t(`${tk}.DefaultEmailDomainLearnMore`)}</a>.
</span>
@@ -159,71 +158,71 @@ const GeneralSettings: React.FC = () => {
}} className="w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600" />
<label htmlFor="autoEmailRefresh" className="ml-2 text-sm font-medium text-gray-900 dark:text-gray-300">{t(`${tk}.AutoEmailRefreshLabel`)}</label>
</div>
- </div>
+ </Card>
- <div className={CARD_CLASSES}>
+ <Card>
<h3 className="mb-4 text-lg font-medium text-gray-900 dark:text-white">{t(`${tk}.AliasSettingsTitle`)}</h3>
<div className="mb-4">
- <label htmlFor="defaultIdentityLanguage" className={LABEL_CLASSES}>{t(`${tk}.AliasGenerationLanguageLabel`)}</label>
- <select id="defaultIdentityLanguage" value={identityLanguage} onChange={(e) => {
+ <FormLabel htmlFor="defaultIdentityLanguage">{t(`${tk}.AliasGenerationLanguageLabel`)}</FormLabel>
+ <Select id="defaultIdentityLanguage" value={identityLanguage} onChange={(e) => {
setIdentityLanguage(e.target.value);
void updateSetting('DefaultIdentityLanguage', e.target.value);
- }} className={SELECT_CLASSES}>
+ }}>
{identityLanguages.map(code => <option key={code} value={code}>{getLanguageInfo(code).flag} {getLanguageInfo(code).label}</option>)}
- </select>
+ </Select>
<span className="block text-sm font-normal text-gray-500 truncate dark:text-gray-400">{t(`${tk}.AliasGenerationLanguageDescription`)}</span>
</div>
<div className="mb-4">
- <label htmlFor="defaultIdentityGender" className={LABEL_CLASSES}>{t(`${tk}.AliasGenerationGenderLabel`)}</label>
- <select id="defaultIdentityGender" value={identityGender} onChange={(e) => {
+ <FormLabel htmlFor="defaultIdentityGender">{t(`${tk}.AliasGenerationGenderLabel`)}</FormLabel>
+ <Select id="defaultIdentityGender" value={identityGender} onChange={(e) => {
setIdentityGender(e.target.value);
void updateSetting('DefaultIdentityGender', e.target.value);
- }} className={SELECT_CLASSES}>
+ }}>
<option value="random">{t(`${tk}.RandomOption`)}</option>
<option value="male">{t(`${tk}.MaleOption`)}</option>
<option value="female">{t(`${tk}.FemaleOption`)}</option>
- </select>
+ </Select>
<span className="block text-sm font-normal text-gray-500 truncate dark:text-gray-400">{t(`${tk}.AliasGenerationGenderDescription`)}</span>
</div>
<div className="mb-4">
- <label htmlFor="defaultIdentityAgeRange" className={LABEL_CLASSES}>{t(`${tk}.AliasGenerationAgeRangeLabel`)}</label>
- <select id="defaultIdentityAgeRange" value={identityAgeRange} onChange={(e) => {
+ <FormLabel htmlFor="defaultIdentityAgeRange">{t(`${tk}.AliasGenerationAgeRangeLabel`)}</FormLabel>
+ <Select id="defaultIdentityAgeRange" value={identityAgeRange} onChange={(e) => {
setIdentityAgeRange(e.target.value);
void updateSetting('DefaultIdentityAgeRange', e.target.value);
- }} className={SELECT_CLASSES}>
+ }}>
{ageRanges.map(range => <option key={range} value={range}>{range === 'random' ? t(`${tk}.RandomOption`) : range}</option>)}
- </select>
+ </Select>
<span className="block text-sm font-normal text-gray-500 truncate dark:text-gray-400">{t(`${tk}.AliasGenerationAgeRangeDescription`)}</span>
</div>
- </div>
+ </Card>
- <div className={CARD_CLASSES}>
+ <Card>
<h3 className="mb-4 text-lg font-medium text-gray-900 dark:text-white">{t(`${tk}.ClipboardSettingsTitle`)}</h3>
<div className="mb-4">
- <label htmlFor="clipboardClearSeconds" className={LABEL_CLASSES}>{t(`${tk}.ClipboardClearSecondsLabel`)}</label>
- <select id="clipboardClearSeconds" value={clipboardClearSeconds} onChange={(e) => {
+ <FormLabel htmlFor="clipboardClearSeconds">{t(`${tk}.ClipboardClearSecondsLabel`)}</FormLabel>
+ <Select id="clipboardClearSeconds" value={clipboardClearSeconds} onChange={(e) => {
setClipboardClearSeconds(e.target.value);
void updateSetting('ClipboardClearSeconds', e.target.value);
- }} className={SELECT_CLASSES}>
+ }}>
<option value="0">{t(`${tk}.ClipboardClearDisabledOption`)}</option>
<option value="5">{t(`${tk}.ClipboardClear5SecondsOption`)}</option>
<option value="10">{t(`${tk}.ClipboardClear10SecondsOption`)}</option>
<option value="15">{t(`${tk}.ClipboardClear15SecondsOption`)}</option>
- </select>
+ </Select>
<span className="block text-sm font-normal text-gray-500 dark:text-gray-400">{t(`${tk}.ClipboardClearSecondsDescription`)}</span>
<div className="mt-2 p-3 bg-yellow-50 border border-yellow-200 rounded-lg dark:bg-yellow-900/20 dark:border-yellow-800">
<p className="text-sm text-yellow-800 dark:text-yellow-200">{t(`${tk}.ClipboardClearLimitationNote`)}</p>
</div>
</div>
- </div>
+ </Card>
- <div className={CARD_CLASSES}>
+ <Card>
<h3 className="mb-4 text-lg font-medium text-gray-900 dark:text-white">{t(`${tk}.PasswordSettingsTitle`)}</h3>
<DefaultPasswordSettings />
- </div>
+ </Card>
</PageContent>
</>
);