Skip to content
This repository was archived by the owner on Mar 24, 2024. It is now read-only.

Commit 22b77ae

Browse files
authored
[Front | FlexScreen] Banner | GalleryCard | Product (#99)
* Update styles for Banner and body components * The most significant changes were made to the `Card.tsx` and `Category.tsx` files. In `Card.tsx`, the import statement was updated for the new version, the `useStyles` function was modified to remove the `card` style, and the `GalleryCard` function was updated to remove the `className` attribute from the `Card` component. In `Category.tsx`, the import statement was updated to remove the import of `random` from `lodash-es`, the `useStyles` function was modified to change the `card` and `cate` styles, and the `GalleryCategory` function was updated to change the way `data` is mapped to `GalleryCard` components. Minor changes were also made to the `useStyles` function in `index.tsx` and the `Products` function in `Get.ts`. 1. The import statement in `Card.tsx` was updated to reflect the new version 0.2.0. 2. The `useStyles` function in `Card.tsx` was updated to remove the `card` style. 3. The `GalleryCard` function in `Card.tsx` was updated to remove the `className` attribute from the `Card` component. 4. The import statement in `Category.tsx` was updated to remove the import of `random` from `lodash-es`. 5. The `useStyles` function in `Category.tsx` was updated to change the `card` and `cate` styles. 6. The `GalleryCategory` function in `Category.tsx` was updated to change the way `data` is mapped to `GalleryCard` components. 7. The `useStyles` function in `index.tsx` was updated to change the `minWidth` of the `body` style. 8. The `Products` function in `Get.ts` was updated to change the return type and the return value. * Add griffel plugin and update dependencies * Remove unused dependencies and plugins * The most significant changes include the addition of the `minHeight` property to the `img` class in `Banner.tsx`, the change of the `flexBasis` property in the `space` class in `Banner.tsx`, and the addition of the `fontSize` and `lineHeight` properties to the `white` class in `Banner.tsx`. Additionally, the `truncate` property was added to the `Text` component in `Banner.tsx`, and the version number was updated in `index.tsx`. Lastly, the `flexWrap` and `flexBasis` properties were modified in the `info` and `lex` classes respectively in `index.tsx`. 1. The `minHeight` property was added to the `img` class in `Banner.tsx` with a value of `320px`. This change ensures that the minimum height of the image is maintained at `320px` regardless of the screen size or resolution. 2. The `flexBasis` property was changed to `0` in the `space` class in `Banner.tsx` when the screen width is less than or equal to `1024px`. This change allows the space to shrink to `0` when the screen width is `1024px` or less, providing more flexibility in the layout. 3. The `fontSize` and `lineHeight` properties were added to the `white` class in `Banner.tsx` with values of `tokens.fontSizeBase300` and `tokens.lineHeightBase300` respectively when the screen width is less than or equal to `600px`. This change ensures that the font size and line height are adjusted appropriately for smaller screens. 4. The `truncate` property was added to the `Text` component in `Banner.tsx`. This change allows the text to be truncated if it exceeds the available space. 5. The version number was updated from `0.1.1` to `0.2.0` in `index.tsx`. This change indicates a new version of the application with significant updates. 6. The `flexWrap` property was added to the `info` class in `index.tsx` with a value of `wrap` when the screen width is less than or equal to `600px`. This change allows the items within the `info` class to wrap onto the next line when the screen width is `600px` or less. 7. The `flexBasis` property was changed to `100%` in the `lex` class in `index.tsx` when the screen width is less than or equal to `600px`. This change allows the `lex` class to take up the full width of the container when the screen width is `600px` or less.
1 parent 2b6b87d commit 22b77ae

File tree

9 files changed

+255
-262
lines changed

9 files changed

+255
-262
lines changed

package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@
1818
"@azure/msal-browser": "^3.7.1",
1919
"@azure/msal-common": "^14.6.1",
2020
"@azure/msal-react": "^2.0.10",
21-
"@fluentui/react-components": "^9.46.0",
21+
"@fluentui/react-components": "^9.46.2",
2222
"@fluentui/react-hooks": "^8.6.36",
23-
"@fluentui/react-icons": "^2.0.225",
23+
"@fluentui/react-icons": "^2.0.226",
2424
"@griffel/react": "^1.5.20",
2525
"@lexical/clipboard": "0.10.0",
2626
"@lexical/code": "0.10.0",
@@ -38,7 +38,7 @@
3838
"@lexical/utils": "0.10.0",
3939
"@microsoft/signalr": "^8.0.0",
4040
"@microsoft/signalr-protocol-msgpack": "^8.0.0",
41-
"ahooks": "^3.7.8",
41+
"ahooks": "^3.7.9",
4242
"dayjs": "^1.11.10",
4343
"dexie": "^3.2.4",
4444
"dexie-react-hooks": "^1.1.7",

pnpm-lock.yaml

+194-208
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/banner.jpg

36.6 KB
Loading

src/Pages/Gallery/Banner.tsx

+14-5
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { ColFlex, Cover, Flex } from "~/Helpers/Styles";
66
/**
77
* @author Aloento
88
* @since 1.3.5
9-
* @version 0.1.0
9+
* @version 0.2.0
1010
*/
1111
const useStyles = makeStyles({
1212
main: {
@@ -16,6 +16,7 @@ const useStyles = makeStyles({
1616
...Cover,
1717
aspectRatio: "42/9",
1818
width: "100%",
19+
minHeight: "320px",
1920
...shorthands.borderRadius(tokens.borderRadiusXLarge),
2021
},
2122
mask: {
@@ -32,17 +33,25 @@ const useStyles = makeStyles({
3233
position: "absolute",
3334
top: 0,
3435
...shorthands.padding(tokens.spacingHorizontalXXXL),
36+
height: "-webkit-fill-available",
3537
},
3638
space: {
3739
flexBasis: "50%",
38-
flexShrink: 0
40+
flexShrink: 0,
41+
"@media screen and (max-width: 1024px)": {
42+
flexBasis: 0,
43+
}
3944
},
4045
txt: {
4146
...ColFlex,
42-
rowGap: tokens.spacingVerticalXL,
47+
justifyContent: "space-around"
4348
},
4449
white: {
45-
color: "white !important"
50+
color: "white !important",
51+
"@media screen and (max-width: 600px)": {
52+
fontSize: tokens.fontSizeBase300,
53+
lineHeight: tokens.lineHeightBase300,
54+
}
4655
}
4756
});
4857

@@ -98,7 +107,7 @@ export function Banner() {
98107
</LargeTitle>
99108
</div>
100109

101-
<Text size={500} className={style.white}>
110+
<Text size={500} truncate className={style.white}>
102111
Lorem Ipsum is simply dummy text of the printing and typesetting industry.
103112
Lorem Ipsum has been the industry's standard dummy text ever since the 1500s,
104113
when an unknown printer took a galley of type and scrambled it to make a type specimen book.

src/Pages/Gallery/Card.tsx

+3-7
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,9 @@ import { Hub } from "~/ShopNet";
88
/**
99
* @author Aloento
1010
* @since 0.1.0
11-
* @version 0.1.0
11+
* @version 0.2.0
1212
*/
1313
const useStyles = makeStyles({
14-
card: {
15-
flexBasis: "23%",
16-
flexGrow: 0,
17-
},
1814
img: {
1915
aspectRatio: "1",
2016
...Cover,
@@ -28,7 +24,7 @@ const log = new Logger("Gallery", "Category", "Card");
2824
/**
2925
* @author Aloento
3026
* @since 0.5.0
31-
* @version 0.1.5
27+
* @version 0.1.6
3228
*/
3329
export function GalleryCard({ Id }: { Id: number }) {
3430
const style = useStyles();
@@ -37,7 +33,7 @@ export function GalleryCard({ Id }: { Id: number }) {
3733
});
3834

3935
return (
40-
<Card className={style.card}>
36+
<Card>
4137
<CardPreview>
4238
<GuidImage className={style.img} Guid={data?.Cover} Log={log} />
4339
</CardPreview>

src/Pages/Gallery/Category.tsx

+15-12
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { SkeletonItem, Title3, makeStyles, tokens } from "@fluentui/react-components";
22
import { useRequest } from "ahooks";
3-
import { random } from "lodash-es";
43
import { Logger } from "~/Helpers/Logger";
54
import { Flex } from "~/Helpers/Styles";
65
import { Hub } from "~/ShopNet";
@@ -9,18 +8,22 @@ import { GalleryCard } from "./Card";
98
/**
109
* @author Aloento
1110
* @since 0.1.0
12-
* @version 0.1.0
11+
* @version 0.2.0
1312
*/
1413
const useStyles = makeStyles({
1514
card: {
16-
flexBasis: "23%",
17-
flexGrow: 0,
15+
flexBasis: "20%",
16+
flexGrow: 1,
17+
flexShrink: 0,
18+
maxWidth: "25%",
19+
minWidth: `${375 / 2}px`,
20+
boxSizing: "border-box",
21+
paddingRight: tokens.spacingHorizontalL,
22+
paddingLeft: tokens.spacingHorizontalL,
1823
},
1924
cate: {
2025
...Flex,
2126
flexWrap: "wrap",
22-
justifyContent: "space-evenly",
23-
columnGap: tokens.spacingVerticalL,
2427
rowGap: tokens.spacingVerticalXL
2528
}
2629
});
@@ -30,7 +33,7 @@ const log = new Logger("Gallery", "Category");
3033
/**
3134
* @author Aloento
3235
* @since 0.5.0
33-
* @version 0.1.4
36+
* @version 0.1.5
3437
*/
3538
export function GalleryCategory({ Category }: { Category: string }) {
3639
const style = useStyles();
@@ -45,11 +48,11 @@ export function GalleryCategory({ Category }: { Category: string }) {
4548
{
4649
loading
4750
? <SkeletonItem size={128} />
48-
: data![0].map((x, i) => <GalleryCard key={i} Id={x} />)
49-
.concat(
50-
Array(data![1]).fill(null)
51-
.map((_, i) => <div key={i + random(10, 100)} className={style.card} />)
52-
)
51+
: data!.map((x, i) => (
52+
<div className={style.card}>
53+
<GalleryCard key={i} Id={x} />
54+
</div>
55+
))
5356
}
5457
</div>
5558
</>

src/Pages/Product/index.tsx

+22-19
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,15 @@ import { ProductRadioList } from "./RadioList";
1616
/**
1717
* @author Aloento
1818
* @since 0.1.0
19-
* @version 0.1.0
19+
* @version 0.2.0
2020
*/
2121
const useStyles = makeStyles({
22-
main: ColFlex,
2322
info: {
2423
...Flex,
25-
columnGap: tokens.spacingHorizontalXXXL
24+
columnGap: tokens.spacingHorizontalXXXL,
25+
"@media screen and (max-width: 600px)": {
26+
flexWrap: "wrap",
27+
}
2628
},
2729
detail: {
2830
...BaseCard,
@@ -38,6 +40,9 @@ const useStyles = makeStyles({
3840
flexBasis: "50%",
3941
flexShrink: 0,
4042
rowGap: tokens.spacingVerticalXL,
43+
"@media screen and (max-width: 600px)": {
44+
flexBasis: "100%",
45+
}
4146
},
4247
fore: {
4348
color: tokens.colorBrandForeground1
@@ -59,7 +64,7 @@ const log = new Logger("Product");
5964
/**
6065
* @author Aloento
6166
* @since 0.1.0
62-
* @version 0.3.0
67+
* @version 0.3.1
6368
*/
6469
function Product() {
6570
const style = useStyles();
@@ -82,27 +87,25 @@ function Product() {
8287
<title>{data?.Name || ""} - {Dic.Name}</title>
8388
</Helmet>
8489

85-
<div className={style.main}>
86-
<div className={style.info}>
87-
<ProductCarousel Id={id} />
90+
<div className={style.info}>
91+
<ProductCarousel Id={id} />
8892

89-
<div className={style.lex}>
90-
<div className={style.detail}>
91-
<LargeTitle className={style.fore}>
92-
{data?.Name || "Loading..."}
93-
</LargeTitle>
93+
<div className={style.lex}>
94+
<div className={style.detail}>
95+
<LargeTitle className={style.fore}>
96+
{data?.Name || "Loading..."}
97+
</LargeTitle>
9498

95-
<Divider />
99+
<Divider />
96100

97-
<ProductRadioList ProdId={id} />
101+
<ProductRadioList ProdId={id} />
98102

99-
<Divider />
103+
<Divider />
100104

101-
<ProductQuantity Id={id} />
102-
</div>
103-
104-
<ProductLexicalRender ProdId={id} />
105+
<ProductQuantity Id={id} />
105106
</div>
107+
108+
<ProductLexicalRender ProdId={id} />
106109
</div>
107110
</div>
108111
</RadioGroupContext>

src/Pages/index.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import { NotFound } from "./404";
1515
const useStyles = makeStyles({
1616
body: {
1717
...ColFlex,
18-
minWidth: "1024px",
18+
minWidth: "375px",
1919
position: "absolute",
2020
marginTop: `${NavH}px`,
2121
width: "100%",

src/ShopNet/Gallery/Get.ts

+3-7
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,10 @@ export abstract class GalleryGet extends ShopNet {
1818
/**
1919
* @author Aloento
2020
* @since 0.5.0
21-
* @version 0.2.1
21+
* @version 0.2.2
2222
*/
23-
public static async Products(category: string): Promise<[number[], number]> {
23+
public static async Products(category: string): Promise<number[]> {
2424
const nums = await this.GetTimeCache<number[]>(category, "GalleryGetProducts", (x) => x.add(1, "m"), category);
25-
26-
return [
27-
nums,
28-
4 - (nums.length % 4)
29-
];
25+
return nums;
3026
}
3127
}

0 commit comments

Comments
 (0)