0
Fork 0
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:
Gao Sun 2022-03-09 16:11:08 +08:00 committed by GitHub
parent dab3c12bea
commit 10c2b464b1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 2 deletions

View file

@ -12,6 +12,7 @@
.title {
font: var(--font-body);
color: var(--color-primary);
text-decoration: none;
}
.subtitle {

View file

@ -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>

View file

@ -84,6 +84,7 @@ const Applications = () => {
title={name}
subtitle={t(`${applicationTypeI18nKey[type]}.title`)}
icon={<ImagePlaceholder />}
to={`/applications/${id}`}
/>
</td>
<td>