pl-fe: profile fields panel doesn't need a title

Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
This commit is contained in:
marcin mikołajczak 2024-09-27 22:04:48 +02:00
parent 4378adef9a
commit 9227eef670
3 changed files with 15 additions and 15 deletions

View file

@ -26,7 +26,7 @@ const WidgetBody: React.FC<IWidgetBody> = ({ children }): JSX.Element => (
interface IWidget {
/** Widget title text. */
title: React.ReactNode;
title?: React.ReactNode;
/** Callback when the widget action is clicked. */
onActionClick?: () => void;
/** URL to the svg icon for the widget action. */
@ -47,17 +47,19 @@ const Widget: React.FC<IWidget> = ({
action,
}): JSX.Element => (
<Stack space={4}>
<HStack space={2} alignItems='center' justifyContent='between'>
<WidgetTitle title={title} />
{action || (onActionClick && (
<IconButton
className='ml-2 size-6 text-black dark:text-white rtl:rotate-180'
src={actionIcon}
onClick={onActionClick}
title={actionTitle}
/>
))}
</HStack>
{title || action || onActionClick && (
<HStack space={2} alignItems='center' justifyContent='between'>
{title && <WidgetTitle title={title} />}
{action || (onActionClick && (
<IconButton
className='ml-2 size-6 text-black dark:text-white rtl:rotate-180'
src={actionIcon}
onClick={onActionClick}
title={actionTitle}
/>
))}
</HStack>
)}
<WidgetBody>{children}</WidgetBody>
</Stack>
);

View file

@ -1,5 +1,4 @@
import React from 'react';
import { FormattedMessage } from 'react-intl';
import { Widget, Stack } from 'pl-fe/components/ui';
@ -13,7 +12,7 @@ interface IProfileFieldsPanel {
/** Custom profile fields for sidebar. */
const ProfileFieldsPanel: React.FC<IProfileFieldsPanel> = ({ account }) => (
<Widget title={<FormattedMessage id='profile_fields_panel.title' defaultMessage='Profile fields' />}>
<Widget>
<Stack space={4}>
{account.fields.map((field, i) => (
<ProfileField field={field} key={i} />

View file

@ -1288,7 +1288,6 @@
"profile_dropdown.logout": "Log out @{acct}",
"profile_dropdown.switch_account": "Switch accounts",
"profile_dropdown.theme": "Theme",
"profile_fields_panel.title": "Profile fields",
"reactions.all": "All",
"regeneration_indicator.label": "Loading…",
"regeneration_indicator.sublabel": "Your home feed is being prepared!",