mirror of
https://github.com/logto-io/logto.git
synced 2025-03-31 22:51:25 -05:00
refactor(console): support to
in <ItemPreview>
(#345)
This commit is contained in:
parent
dab3c12bea
commit
10c2b464b1
3 changed files with 17 additions and 2 deletions
|
@ -12,6 +12,7 @@
|
|||
.title {
|
||||
font: var(--font-body);
|
||||
color: var(--color-primary);
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.subtitle {
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import React, { ReactNode } from 'react';
|
||||
import { Link, To } from 'react-router-dom';
|
||||
|
||||
import * as styles from './index.module.scss';
|
||||
|
||||
|
@ -6,14 +7,26 @@ type Props = {
|
|||
title: string;
|
||||
subtitle?: string;
|
||||
icon?: ReactNode;
|
||||
to?: To;
|
||||
};
|
||||
|
||||
const ItemPreview = ({ title, subtitle, icon }: Props) => {
|
||||
const ItemPreview = ({ title, subtitle, icon, to }: Props) => {
|
||||
return (
|
||||
<div className={styles.item}>
|
||||
{icon}
|
||||
<div>
|
||||
<div className={styles.title}>{title}</div>
|
||||
{to && (
|
||||
<Link
|
||||
className={styles.title}
|
||||
to={to}
|
||||
onClick={(event) => {
|
||||
event.stopPropagation();
|
||||
}}
|
||||
>
|
||||
{title}
|
||||
</Link>
|
||||
)}
|
||||
{!to && <div className={styles.title}>{title}</div>}
|
||||
{subtitle && <div className={styles.subtitle}>{String(subtitle)}</div>}
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -84,6 +84,7 @@ const Applications = () => {
|
|||
title={name}
|
||||
subtitle={t(`${applicationTypeI18nKey[type]}.title`)}
|
||||
icon={<ImagePlaceholder />}
|
||||
to={`/applications/${id}`}
|
||||
/>
|
||||
</td>
|
||||
<td>
|
||||
|
|
Loading…
Add table
Reference in a new issue