pl-fe: styles migration, less nesting
Signed-off-by: nicole mikołajczyk <git@mkljczk.pl>
This commit is contained in:
@ -1,8 +1,6 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
|
||||||
import Icon from './ui/icon';
|
import Icon from './ui/icon';
|
||||||
import Stack from './ui/stack';
|
|
||||||
import Text from './ui/text';
|
|
||||||
|
|
||||||
interface IEmptyMessage {
|
interface IEmptyMessage {
|
||||||
text: React.ReactNode;
|
text: React.ReactNode;
|
||||||
@ -10,15 +8,11 @@ interface IEmptyMessage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const EmptyMessage: React.FC<IEmptyMessage> = ({ text, icon = require('@phosphor-icons/core/regular/empty.svg') }) => (
|
const EmptyMessage: React.FC<IEmptyMessage> = ({ text, icon = require('@phosphor-icons/core/regular/empty.svg') }) => (
|
||||||
<Stack space={4} className='⁂-empty-message py-6' justifyContent='center' alignItems='center'>
|
<div className='⁂-empty-message'>
|
||||||
<div className='rounded-full bg-gray-200 p-4 dark:bg-gray-800'>
|
<Icon src={icon} aria-hidden />
|
||||||
<Icon src={icon} className='size-6 text-gray-600' />
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<Text theme='muted' align='center'>
|
<p>{text}</p>
|
||||||
{text}
|
</div>
|
||||||
</Text>
|
|
||||||
</Stack>
|
|
||||||
);
|
);
|
||||||
|
|
||||||
export { EmptyMessage };
|
export { EmptyMessage };
|
||||||
|
|||||||
@ -2,7 +2,6 @@ import { Link, type LinkOptions } from '@tanstack/react-router';
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { FormattedNumber } from 'react-intl';
|
import { FormattedNumber } from 'react-intl';
|
||||||
|
|
||||||
import Text from '@/components/ui/text';
|
|
||||||
import { isNumber } from '@/utils/numbers';
|
import { isNumber } from '@/utils/numbers';
|
||||||
|
|
||||||
type IDashCounter = {
|
type IDashCounter = {
|
||||||
@ -18,30 +17,28 @@ const DashCounter: React.FC<IDashCounter> = ({ count, label, percent = false, ..
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
const className = 'flex cursor-pointer flex-col items-center space-y-2 rounded bg-gray-200 p-4 transition-transform hover:-translate-y-1 dark:bg-gray-800';
|
|
||||||
|
|
||||||
const body = (
|
const body = (
|
||||||
<>
|
<>
|
||||||
<Text align='center' size='2xl' weight='medium'>
|
<p className='⁂-dashcounter__number'>
|
||||||
<FormattedNumber
|
<FormattedNumber
|
||||||
value={count}
|
value={count}
|
||||||
style={percent ? 'unit' : undefined}
|
style={percent ? 'unit' : undefined}
|
||||||
unit={percent ? 'percent' : undefined}
|
unit={percent ? 'percent' : undefined}
|
||||||
numberingSystem='latn'
|
numberingSystem='latn'
|
||||||
/>
|
/>
|
||||||
</Text>
|
</p>
|
||||||
<Text align='center'>
|
<p className='⁂-dashcounter__label'>
|
||||||
{label}
|
{label}
|
||||||
</Text>
|
</p>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!('to' in rest)) {
|
if (!('to' in rest)) {
|
||||||
return <span className={className}>{body}</span>;
|
return <span className='⁂-dashcounter'>{body}</span>;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Link className={className} {...rest}>
|
<Link className='⁂-dashcounter' {...rest}>
|
||||||
{body}
|
{body}
|
||||||
</Link>
|
</Link>
|
||||||
);
|
);
|
||||||
@ -53,7 +50,7 @@ interface IDashCounters {
|
|||||||
|
|
||||||
/** Wrapper container for dash counters. */
|
/** Wrapper container for dash counters. */
|
||||||
const DashCounters: React.FC<IDashCounters> = ({ children }) => (
|
const DashCounters: React.FC<IDashCounters> = ({ children }) => (
|
||||||
<div className='grid grid-cols-1 gap-2 sm:grid-cols-2'>
|
<div className='⁂-dashboard__counters'>
|
||||||
{children}
|
{children}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
@ -5,7 +5,6 @@ import List, { ListItem } from '@/components/list';
|
|||||||
import { CardTitle } from '@/components/ui/card';
|
import { CardTitle } from '@/components/ui/card';
|
||||||
import Column from '@/components/ui/column';
|
import Column from '@/components/ui/column';
|
||||||
import Icon from '@/components/ui/icon';
|
import Icon from '@/components/ui/icon';
|
||||||
import Stack from '@/components/ui/stack';
|
|
||||||
import { Counter } from '@/features/admin/components/counter';
|
import { Counter } from '@/features/admin/components/counter';
|
||||||
import { DashCounter, DashCounters } from '@/features/admin/components/dashcounter';
|
import { DashCounter, DashCounters } from '@/features/admin/components/dashcounter';
|
||||||
import { Dimension } from '@/features/admin/components/dimension';
|
import { Dimension } from '@/features/admin/components/dimension';
|
||||||
@ -50,7 +49,7 @@ const Dashboard: React.FC = () => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<Column label={intl.formatMessage(messages.heading)}>
|
<Column label={intl.formatMessage(messages.heading)}>
|
||||||
<Stack space={6} className='mt-4'>
|
<div className='⁂-dashboard'>
|
||||||
<DashCounters>
|
<DashCounters>
|
||||||
{features.mastodonAdminMetrics ? (
|
{features.mastodonAdminMetrics ? (
|
||||||
<Counter
|
<Counter
|
||||||
@ -224,15 +223,12 @@ const Dashboard: React.FC = () => {
|
|||||||
<ListItem label={<FormattedMessage id='admin.software.frontend' defaultMessage='Frontend' />}>
|
<ListItem label={<FormattedMessage id='admin.software.frontend' defaultMessage='Frontend' />}>
|
||||||
<a
|
<a
|
||||||
href={sourceCode.ref ? `${sourceCode.url}/tree/${sourceCode.ref}` : sourceCode.url}
|
href={sourceCode.ref ? `${sourceCode.url}/tree/${sourceCode.ref}` : sourceCode.url}
|
||||||
className='flex items-center space-x-1 truncate'
|
className='⁂-dashboard__source-code'
|
||||||
target='_blank'
|
target='_blank'
|
||||||
>
|
>
|
||||||
<span>{sourceCode.displayName} {sourceCode.version}</span>
|
<span>{sourceCode.displayName} {sourceCode.version}</span>
|
||||||
|
|
||||||
<Icon
|
<Icon src={require('@phosphor-icons/core/regular/arrow-square-out.svg')} />
|
||||||
className='size-4'
|
|
||||||
src={require('@phosphor-icons/core/regular/arrow-square-out.svg')}
|
|
||||||
/>
|
|
||||||
</a>
|
</a>
|
||||||
</ListItem>
|
</ListItem>
|
||||||
|
|
||||||
@ -242,7 +238,7 @@ const Dashboard: React.FC = () => {
|
|||||||
</ListItem>
|
</ListItem>
|
||||||
)}
|
)}
|
||||||
</List>
|
</List>
|
||||||
</Stack>
|
</div>
|
||||||
</Column>
|
</Column>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
32
packages/pl-fe/src/styles/new/admin.scss
Normal file
32
packages/pl-fe/src/styles/new/admin.scss
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
@use 'mixins';
|
||||||
|
|
||||||
|
.⁂-dashboard {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 1.5rem;
|
||||||
|
|
||||||
|
&__counters {
|
||||||
|
@apply grid grid-cols-1 gap-2 sm:grid-cols-2;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__source-code {
|
||||||
|
@apply flex items-center space-x-1 truncate;
|
||||||
|
|
||||||
|
svg {
|
||||||
|
height: 1rem;
|
||||||
|
width: 1rem;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.⁂-dashcounter {
|
||||||
|
@apply flex cursor-pointer flex-col items-center space-y-2 rounded bg-gray-200 p-4 transition-transform hover:-translate-y-1 dark:bg-gray-800;
|
||||||
|
|
||||||
|
&__number {
|
||||||
|
@include mixins.text($align: center, $size: 2xl, $weight: medium);
|
||||||
|
}
|
||||||
|
|
||||||
|
&__label {
|
||||||
|
@include mixins.text($align: center);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -408,4 +408,33 @@ div[data-viewport-type="window"]:has(.⁂-empty-message) {
|
|||||||
@include mixins.button($theme: secondary);
|
@include mixins.button($theme: secondary);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.⁂-empty-message {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
gap: 1rem;
|
||||||
|
padding: 1.5rem 0;
|
||||||
|
|
||||||
|
> div {
|
||||||
|
background: rgb(var(--color-gray-200));
|
||||||
|
padding: 1rem;
|
||||||
|
border-radius: 50%;
|
||||||
|
|
||||||
|
&:is(.dark *) {
|
||||||
|
background: rgb(var(--color-gray-800));
|
||||||
|
}
|
||||||
|
|
||||||
|
svg {
|
||||||
|
height: 1.5rem;
|
||||||
|
width: 1.5rem;
|
||||||
|
color: rgb(var(--color-gray-600))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
p {
|
||||||
|
@include mixins.text($align: center, $theme: muted);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@ -5,6 +5,7 @@
|
|||||||
@use 'statuses';
|
@use 'statuses';
|
||||||
@use 'timelines';
|
@use 'timelines';
|
||||||
@use 'compose';
|
@use 'compose';
|
||||||
|
@use 'admin';
|
||||||
@use 'drive';
|
@use 'drive';
|
||||||
@use 'chats';
|
@use 'chats';
|
||||||
@use 'events';
|
@use 'events';
|
||||||
|
|||||||
Reference in New Issue
Block a user