Skip to content

Commit

Permalink
Merge pull request #10 from yuanyxh/yuanyxh
Browse files Browse the repository at this point in the history
feat: project variation
  • Loading branch information
yuanyxh authored Sep 11, 2023
2 parents c9fc84c + 5482240 commit 012ab72
Show file tree
Hide file tree
Showing 54 changed files with 1,110 additions and 233 deletions.
Binary file modified public/favicon.ico
Binary file not shown.
2 changes: 1 addition & 1 deletion public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
-->
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />

<title>React App</title>
<title>illustrate</title>
</head>
<body ontouchstart>
<noscript>You need to enable JavaScript to run this app.</noscript>
Expand Down
Binary file added public/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified public/logo192.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified public/logo512.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions public/manifest.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"short_name": "React App",
"name": "Create React App Sample",
"short_name": "illustrate",
"name": "illustrate",
"icons": [
{
"src": "favicon.ico",
Expand Down
34 changes: 34 additions & 0 deletions src/components/ExtraInformation/ExtraInformation.module.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
.extra-information {
margin: 10px 0;
padding: 10px;
border: var(--border);
border-radius: var(--border-radius-base);
}

.title {
font-size: calc(var(--font-size-base) * 1.1);
font-weight: var(--font-weight-primary);
color: var(--text-color);
}

.wrapper,
.other {
margin-top: 10px;
}

.other {
display: flex;
flex-wrap: wrap;
align-items: center;
}

.platform {
color: var(--color-info);
}

.platform-item {
display: flex;
flex-wrap: wrap;
align-items: center;
column-gap: 10px;
}
79 changes: 79 additions & 0 deletions src/components/ExtraInformation/ExtraInformation.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
import React from 'react';
import { Link } from 'react-router-dom';
import { Platform } from '@/enum';
import Tip from '@/components/Tip/Tip';
import Text from '@/components/Text/Text';
import style from './ExtraInformation.module.css';

interface ExtraInformationProps {
platform: {
[key in keyof typeof Platform]?: key extends 'blog'
? { title: string; url: string }
: { url: string };
};
}

export default function ExtraInformation(props: ExtraInformationProps) {
const { platform } = props;

return (
<Tip type="primary">
{{
header() {
return <span>案例相关链接:</span>;
},
body() {
return (
<div className={style['wrapper']}>
<div className={style['foremost']}>
<span className={style['platform']}>{Platform['blog']}</span>

<Link to={platform['blog']?.url || ''} target="_blank">
<Text type="primary">{platform['blog']?.title}</Text>
</Link>
</div>

<div className={style['other']}>
<span className={style['platform']}>发布平台:</span>

<p className={style['platform-item']}>
{Object.keys(platform).map((key) => (
<Link
key={key}
to={platform[key as keyof typeof Platform]?.url || ''}
target="_blank"
>
<Text type="primary">
{Platform[key as keyof typeof Platform]}
</Text>
</Link>
))}
</p>
</div>
</div>
);
}
}}
</Tip>

// <div className={style['extra-information']}>
// <h1 className={style['title']}>案例相关链接:</h1>

// {/* <div className={style['wrapper']}>
// {Object.keys(platform).map((key) => (
// <div key={key} className={style['group']}>
// <span className={style['platform']}>
// {Platform[key as keyof typeof Platform]}:
// </span>

// {platform[key as keyof typeof Platform]?.map(({ title, url }) => (
// <Link key={url} to={url} target="_blank">
// <Text type="primary">{title}</Text>
// </Link>
// ))}
// </div>
// ))}
// </div> */}
// </div>
);
}
2 changes: 1 addition & 1 deletion src/components/InputNumber/InputNumber.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
align-items: center;
height: auto;
position: absolute;
z-index: 1;
z-index: var(--z-index-normal);
top: 1px;
bottom: 1px;
width: var(--input-number-btn-width);
Expand Down
2 changes: 1 addition & 1 deletion src/components/Overlay/Overlay.module.css
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.overlay {
position: fixed;
inset: 0;
z-index: 2000;
z-index: var(--z-index-highest);
background-color: var(--overlay-color-lighter);
overflow: auto;
}
23 changes: 23 additions & 0 deletions src/components/ScreenBoundary/ScreenBoundary.module.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
.screen-boundary {
margin: 10px;
margin-top: 50px;
}

.title {
padding: 10px;
font-size: var(--font-size-large);
font-weight: var(--font-weight-primary);
color: var(--color-warning);
}

.desc {
margin-top: 15px;
font-size: var(--font-size-large);
line-height: var(--font-line-height-primary);
color: var(--text-color-regular);
}

.footer {
margin-top: 15px;
text-align: end;
}
51 changes: 51 additions & 0 deletions src/components/ScreenBoundary/ScreenBoundary.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import React, { useContext } from 'react';
import { Link } from 'react-router-dom';
import Card from '@/components/Card/Card';
import Text from '@/components/Text/Text';
import Button from '@/components/Button/Button';
import { ScreenContext } from '@/layout/Layout';
import style from './ScreenBoundary.module.css';

interface ScreenBoundaryProps extends ChildProps {
children: React.ReactElement;
displayInMobile?: boolean;
}

export default function ScreenBoundary(props: ScreenBoundaryProps) {
const { children, displayInMobile = false } = props;

const isSmallScreen = useContext(ScreenContext);

if (isSmallScreen && displayInMobile === false) {
return (
<Card className={style['screen-boundary']}>
{{
header() {
return <h1 className={style['title']}>温馨提示</h1>;
},
body() {
return (
<>
<Text block type="info">
此页不建议在移动端或小屏设备上渲染
</Text>

<p className={style['desc']}>
基于技术或用户体验考虑,当前页面暂不支持在此环境中展示,建议使用大屏设备体验,如电脑、平板等。
</p>

<footer className={style['footer']}>
<Link to={'/'}>
<Button type="primary">返回首页</Button>
</Link>
</footer>
</>
);
}
}}
</Card>
);
}

return children;
}
4 changes: 2 additions & 2 deletions src/components/Select/Select.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
display: none;
position: absolute;
top: 110%;
background-color: #fff;
background-color: var(--bg-color);
border: 1px solid var(--border-color-light);
box-shadow: var(--box-shadow-light);
border-radius: var(--border-radius-base);
Expand All @@ -53,7 +53,7 @@
line-height: 20px;
width: 100%;
word-wrap: break-word;
z-index: 10;
z-index: var(--z-index-useful);
}

.select-options-item {
Expand Down
81 changes: 81 additions & 0 deletions src/components/Tip/Tip.module.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
.tip {
--tip-background-color: var(--fill-color-extra-light);
--tip-border-left-color: var(--border-color);

position: relative;
margin: 20px 0;
padding: 8px 16px;
background-color: var(--tip-background-color);
border-radius: 4px;
border-left: 5px solid var(--tip-border-left-color);
}

.tip-primary {
--tip-background-color: var(--color-primary-light-9);
--tip-border-left-color: var(--color-primary);
}

.tip-success {
--tip-background-color: var(--color-success-light-9);
--tip-border-left-color: var(--color-success-dark-2);
}

.tip-info {
--tip-background-color: var(--color-info-light-9);
--tip-border-left-color: var(--color-info);
}

.tip-warning {
--tip-background-color: var(--color-warning-light-9);
--tip-border-left-color: var(--color-warning);
}

.tip-danger {
--tip-background-color: var(--color-danger-light-9);
--tip-border-left-color: var(--color-danger);
}

.tip-title {
margin: 1rem 0;
margin-top: 0;
margin-bottom: 0.5rem;
font-size: var(--font-size-medium);
font-weight: var(--font-weight-primary);
line-height: 1.7;
}

.tip-desc {
font-size: var(--font-size-base);
color: var(--text-color);
word-break: break-all;
}

.tip-close {
position: absolute;
right: 8px;
top: 8px;
background: none;
outline: none;
border: none;
cursor: pointer;
}

.tip-close i {
font-size: var(--font-size-small);
color: var(--text-color);
}

.tip-leave {
animation: leave var(--transition-duration-fast);
transform-origin: top center;
}

@keyframes leave {
0% {
opacity: 1;
}

100% {
opacity: 0;
}
}
Loading

0 comments on commit 012ab72

Please sign in to comment.