From b30c4311405f84663089364480dc9e96ace7a854 Mon Sep 17 00:00:00 2001 From: Gao Sun Date: Fri, 4 Mar 2022 13:10:39 +0800 Subject: [PATCH 1/3] feat(console): init console table --- .../src/assets/images/default-placeholder.svg | 18 +++++++++++ .../components/AppContent/index.module.scss | 4 +++ .../src/components/Button/index.module.scss | 1 + .../ImagePlaceholder/index.module.scss | 4 +++ .../src/components/ImagePlaceholder/index.tsx | 11 +++++++ .../components/ItemPreview/index.module.scss | 21 +++++++++++++ .../src/components/ItemPreview/index.tsx | 23 ++++++++++++++ .../src/pages/Applications/index.module.scss | 7 +++++ .../console/src/pages/Applications/index.tsx | 22 +++++++++++++ packages/console/src/scss/_underscore.scss | 6 ++++ packages/console/src/scss/normalized.scss | 31 +++++++++++++++++++ 11 files changed, 148 insertions(+) create mode 100644 packages/console/src/assets/images/default-placeholder.svg create mode 100644 packages/console/src/components/ImagePlaceholder/index.module.scss create mode 100644 packages/console/src/components/ImagePlaceholder/index.tsx create mode 100644 packages/console/src/components/ItemPreview/index.module.scss create mode 100644 packages/console/src/components/ItemPreview/index.tsx diff --git a/packages/console/src/assets/images/default-placeholder.svg b/packages/console/src/assets/images/default-placeholder.svg new file mode 100644 index 000000000..8e0489fcb --- /dev/null +++ b/packages/console/src/assets/images/default-placeholder.svg @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + diff --git a/packages/console/src/components/AppContent/index.module.scss b/packages/console/src/components/AppContent/index.module.scss index c01d34663..fdbf75cc6 100644 --- a/packages/console/src/components/AppContent/index.module.scss +++ b/packages/console/src/components/AppContent/index.module.scss @@ -30,8 +30,10 @@ --color-error-90: #ffdad4; --color-inverse-on-surface: #eff1f1; --color-neutral-70: #a9acac; + --color-neutral-90: #e0e3e3; --color-on-secondary-container: #201c00; --color-component-caption: #747778; + --color-outline: #78767f; } $font-family: 'SF UI Text', 'SF Pro Display', sans-serif; @@ -40,5 +42,7 @@ $font-family: 'SF UI Text', 'SF Pro Display', sans-serif; --font-title-medium: 500 16px/24px #{$font-family}; --font-heading-small: 600 24px/32px #{$font-family}; --font-body: normal 16px/22px #{$font-family}; + --font-small-text: normal 12px/17px #{$font-family}; --font-button: 500 14px/20px #{$font-family}; + --font-subhead-2: 500 14px/20px #{$font-family}; } diff --git a/packages/console/src/components/Button/index.module.scss b/packages/console/src/components/Button/index.module.scss index e0da289d8..2c34cd488 100644 --- a/packages/console/src/components/Button/index.module.scss +++ b/packages/console/src/components/Button/index.module.scss @@ -6,6 +6,7 @@ border-radius: _.unit(2); font: var(--font-button); transition: background 0.2s ease-in-out; + @include _.text-ellipsis; &:not(:disabled) { cursor: pointer; diff --git a/packages/console/src/components/ImagePlaceholder/index.module.scss b/packages/console/src/components/ImagePlaceholder/index.module.scss new file mode 100644 index 000000000..ff20b9445 --- /dev/null +++ b/packages/console/src/components/ImagePlaceholder/index.module.scss @@ -0,0 +1,4 @@ +.placeholder { + width: 50px; + height: 50px; +} diff --git a/packages/console/src/components/ImagePlaceholder/index.tsx b/packages/console/src/components/ImagePlaceholder/index.tsx new file mode 100644 index 000000000..32628230b --- /dev/null +++ b/packages/console/src/components/ImagePlaceholder/index.tsx @@ -0,0 +1,11 @@ +import React from 'react'; + +import defaultPlaceholder from '@/assets/images/default-placeholder.svg'; + +import * as styles from './index.module.scss'; + +const ImagePlaceholder = () => { + return ; +}; + +export default ImagePlaceholder; diff --git a/packages/console/src/components/ItemPreview/index.module.scss b/packages/console/src/components/ItemPreview/index.module.scss new file mode 100644 index 000000000..c0e0df2e3 --- /dev/null +++ b/packages/console/src/components/ItemPreview/index.module.scss @@ -0,0 +1,21 @@ +@use '@/scss/underscore' as _; + +.item { + display: flex; + align-items: center; + + > div:not(:first-child) { + margin-left: _.unit(4); + } + + .title { + font: var(--font-body); + color: var(--color-primary); + } + + .subtitle { + margin-top: _.unit(0.5); + font: var(--font-small-text); + color: var(--color-outline); + } +} diff --git a/packages/console/src/components/ItemPreview/index.tsx b/packages/console/src/components/ItemPreview/index.tsx new file mode 100644 index 000000000..e45186867 --- /dev/null +++ b/packages/console/src/components/ItemPreview/index.tsx @@ -0,0 +1,23 @@ +import React, { ReactNode } from 'react'; + +import * as styles from './index.module.scss'; + +type Props = { + title: string; + subtitle?: string; + icon?: ReactNode; +}; + +const ItemPreview = ({ title, subtitle, icon }: Props) => { + return ( +
+ {icon} +
+
{title}
+ {subtitle &&
{subtitle}
} +
+
+ ); +}; + +export default ItemPreview; diff --git a/packages/console/src/pages/Applications/index.module.scss b/packages/console/src/pages/Applications/index.module.scss index 1a2f34822..ec0222efc 100644 --- a/packages/console/src/pages/Applications/index.module.scss +++ b/packages/console/src/pages/Applications/index.module.scss @@ -1,4 +1,11 @@ +@use '@/scss/underscore' as _; + .headline { display: flex; justify-content: space-between; } + +.table { + margin-top: _.unit(6); + width: 100%; +} diff --git a/packages/console/src/pages/Applications/index.tsx b/packages/console/src/pages/Applications/index.tsx index ca0b17e0d..bdf1a86c2 100644 --- a/packages/console/src/pages/Applications/index.tsx +++ b/packages/console/src/pages/Applications/index.tsx @@ -3,6 +3,8 @@ import React from 'react'; import Button from '@/components/Button'; import Card from '@/components/Card'; import CardTitle from '@/components/CardTitle'; +import ImagePlaceholder from '@/components/ImagePlaceholder'; +import ItemPreview from '@/components/ItemPreview'; import * as styles from './index.module.scss'; @@ -13,6 +15,26 @@ const Applications = () => {