@sunggang/ui-lib 0.0.5 → 0.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (110) hide show
  1. package/index.esm.d.ts +1 -0
  2. package/index.esm.js +5870 -0
  3. package/package.json +5 -2
  4. package/src/components/ui/switch.d.ts +4 -0
  5. package/src/{index.ts → index.d.ts} +0 -2
  6. package/src/lib/DropImage/index.d.ts +14 -0
  7. package/src/lib/Modal/ErrorContent.d.ts +7 -0
  8. package/src/lib/Modal/Modal.d.ts +7 -0
  9. package/src/lib/Modal/ModalContent.d.ts +10 -0
  10. package/src/lib/Spin/index.d.ts +5 -0
  11. package/src/lib/UploadImage/BaseTemplate.d.ts +7 -0
  12. package/src/lib/UploadImage/CustomUpload.d.ts +10 -0
  13. package/src/lib/hello-server.d.ts +1 -0
  14. package/src/lib/uiLibrary.d.ts +4 -0
  15. package/src/lib/utils.d.ts +2 -0
  16. package/src/server.d.ts +1 -0
  17. package/.eslintrc.json +0 -18
  18. package/.storybook/main.js +0 -14
  19. package/.storybook/preview.js +0 -1
  20. package/.storybook/tailwind-imports.css +0 -81
  21. package/components.json +0 -15
  22. package/postcss.config.js +0 -10
  23. package/project.json +0 -31
  24. package/src/components/ui/switch.tsx +0 -27
  25. package/src/lib/DropImage/index.stories.tsx +0 -42
  26. package/src/lib/DropImage/index.tsx +0 -110
  27. package/src/lib/Modal/BaseModal.jsx +0 -52
  28. package/src/lib/Modal/ErrorContent.tsx +0 -21
  29. package/src/lib/Modal/FullScreenModal.jsx +0 -39
  30. package/src/lib/Modal/Modal.tsx +0 -36
  31. package/src/lib/Modal/ModalContent.tsx +0 -60
  32. package/src/lib/Modal/NoticeModal.jsx +0 -91
  33. package/src/lib/Modal/index.jsx +0 -1
  34. package/src/lib/Spin/index.tsx +0 -20
  35. package/src/lib/Switch/index.stories.tsx +0 -24
  36. package/src/lib/UploadImage/BaseTemplate.tsx +0 -73
  37. package/src/lib/UploadImage/CustomUpload.stories.tsx +0 -52
  38. package/src/lib/UploadImage/CustomUpload.tsx +0 -95
  39. package/src/lib/hello-server.tsx +0 -4
  40. package/src/lib/uiLibrary.spec.tsx +0 -10
  41. package/src/lib/uiLibrary.tsx +0 -14
  42. package/src/lib/utils.ts +0 -6
  43. package/src/server.ts +0 -2
  44. package/storybook-static/249.d700bcb8.iframe.bundle.js +0 -95
  45. package/storybook-static/249.d700bcb8.iframe.bundle.js.LICENSE.txt +0 -25
  46. package/storybook-static/249.d700bcb8.iframe.bundle.js.map +0 -1
  47. package/storybook-static/272.859c45b5.iframe.bundle.js +0 -1
  48. package/storybook-static/297.86b29044.iframe.bundle.js +0 -1
  49. package/storybook-static/301.7b83a51f.iframe.bundle.js +0 -1
  50. package/storybook-static/311.5beb2d3d.iframe.bundle.js +0 -1
  51. package/storybook-static/312.aa18d841.iframe.bundle.js +0 -1
  52. package/storybook-static/501.1fba3663.iframe.bundle.js +0 -1
  53. package/storybook-static/754.9ec23ac4.iframe.bundle.js +0 -1
  54. package/storybook-static/777.4b1d90f9.iframe.bundle.js +0 -1
  55. package/storybook-static/794.2230a3f3.iframe.bundle.js +0 -1
  56. package/storybook-static/852.18487f4c.iframe.bundle.js +0 -402
  57. package/storybook-static/852.18487f4c.iframe.bundle.js.LICENSE.txt +0 -23
  58. package/storybook-static/852.18487f4c.iframe.bundle.js.map +0 -1
  59. package/storybook-static/DropImage-index-stories.befa1b35.iframe.bundle.js +0 -1
  60. package/storybook-static/Switch-index-stories.9cfb2ba1.iframe.bundle.js +0 -1
  61. package/storybook-static/UploadImage-CustomUpload-stories.521444aa.iframe.bundle.js +0 -1
  62. package/storybook-static/favicon.svg +0 -7
  63. package/storybook-static/iframe.html +0 -370
  64. package/storybook-static/index.html +0 -151
  65. package/storybook-static/index.json +0 -1
  66. package/storybook-static/main.6f3c811b.iframe.bundle.js +0 -1
  67. package/storybook-static/project.json +0 -1
  68. package/storybook-static/runtime~main.28408b82.iframe.bundle.js +0 -1
  69. package/storybook-static/sb-addons/essentials-actions-2/manager-bundle.js +0 -3
  70. package/storybook-static/sb-addons/essentials-actions-2/manager-bundle.js.LEGAL.txt +0 -0
  71. package/storybook-static/sb-addons/essentials-backgrounds-3/manager-bundle.js +0 -12
  72. package/storybook-static/sb-addons/essentials-backgrounds-3/manager-bundle.js.LEGAL.txt +0 -0
  73. package/storybook-static/sb-addons/essentials-controls-1/manager-bundle.js +0 -79
  74. package/storybook-static/sb-addons/essentials-controls-1/manager-bundle.js.LEGAL.txt +0 -28
  75. package/storybook-static/sb-addons/essentials-measure-6/manager-bundle.js +0 -3
  76. package/storybook-static/sb-addons/essentials-measure-6/manager-bundle.js.LEGAL.txt +0 -0
  77. package/storybook-static/sb-addons/essentials-outline-7/manager-bundle.js +0 -3
  78. package/storybook-static/sb-addons/essentials-outline-7/manager-bundle.js.LEGAL.txt +0 -0
  79. package/storybook-static/sb-addons/essentials-toolbars-5/manager-bundle.js +0 -3
  80. package/storybook-static/sb-addons/essentials-toolbars-5/manager-bundle.js.LEGAL.txt +0 -0
  81. package/storybook-static/sb-addons/essentials-viewport-4/manager-bundle.js +0 -3
  82. package/storybook-static/sb-addons/essentials-viewport-4/manager-bundle.js.LEGAL.txt +0 -0
  83. package/storybook-static/sb-addons/storybook-core-server-presets-0/common-manager-bundle.js +0 -3
  84. package/storybook-static/sb-addons/storybook-core-server-presets-0/common-manager-bundle.js.LEGAL.txt +0 -0
  85. package/storybook-static/sb-common-assets/fonts.css +0 -31
  86. package/storybook-static/sb-common-assets/nunito-sans-bold-italic.woff2 +0 -0
  87. package/storybook-static/sb-common-assets/nunito-sans-bold.woff2 +0 -0
  88. package/storybook-static/sb-common-assets/nunito-sans-italic.woff2 +0 -0
  89. package/storybook-static/sb-common-assets/nunito-sans-regular.woff2 +0 -0
  90. package/storybook-static/sb-manager/WithTooltip-Y7J54OF7-KHQOWZXS.js +0 -1
  91. package/storybook-static/sb-manager/chunk-3F3RRPB3.js +0 -347
  92. package/storybook-static/sb-manager/chunk-62YMTM65.js +0 -6
  93. package/storybook-static/sb-manager/chunk-AQBE2B7B.js +0 -183
  94. package/storybook-static/sb-manager/chunk-Q3RBXCN3.js +0 -231
  95. package/storybook-static/sb-manager/chunk-XP3HGWTR.js +0 -1
  96. package/storybook-static/sb-manager/chunk-YME6VNXZ.js +0 -9
  97. package/storybook-static/sb-manager/formatter-B5HCVTEV-7DCBOGO6.js +0 -58
  98. package/storybook-static/sb-manager/globals-module-info.js +0 -1
  99. package/storybook-static/sb-manager/globals-runtime.js +0 -1
  100. package/storybook-static/sb-manager/globals.js +0 -1
  101. package/storybook-static/sb-manager/index.js +0 -1
  102. package/storybook-static/sb-manager/runtime.js +0 -1
  103. package/storybook-static/sb-manager/syntaxhighlighter-JOJW2KGS-WAFIMSO6.js +0 -1
  104. package/storybook-static/sb-preview/globals.js +0 -1
  105. package/storybook-static/sb-preview/runtime.js +0 -128
  106. package/tailwind.config.js +0 -76
  107. package/tsconfig.json +0 -25
  108. package/tsconfig.lib.json +0 -29
  109. package/tsconfig.storybook.json +0 -31
  110. /package/{src/lib/uiLibrary.module.css → index.esm.css} +0 -0
package/package.json CHANGED
@@ -1,11 +1,14 @@
1
1
  {
2
2
  "name": "@sunggang/ui-lib",
3
- "version": "0.0.5",
3
+ "version": "0.0.6",
4
4
  "dependencies": {
5
5
  "@radix-ui/react-switch": "^1.0.3",
6
6
  "class-variance-authority": "^0.7.0",
7
7
  "clsx": "^2.1.0",
8
8
  "tailwind-merge": "^2.2.2",
9
9
  "tailwindcss-animate": "^1.0.7"
10
- }
10
+ },
11
+ "module": "./index.esm.js",
12
+ "type": "module",
13
+ "main": "./index.esm.js"
11
14
  }
@@ -0,0 +1,4 @@
1
+ import * as React from 'react';
2
+ import * as SwitchPrimitives from '@radix-ui/react-switch';
3
+ export declare const Switch: React.ForwardRefExoticComponent<Omit<SwitchPrimitives.SwitchProps & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
4
+ export default Switch;
@@ -1,5 +1,3 @@
1
- // Use this file to export React client components (e.g. those with 'use client' directive) or other non-server utilities
2
-
3
1
  export * from './lib/uiLibrary';
4
2
  export * from './lib/Spin';
5
3
  export * from './lib/DropImage';
@@ -0,0 +1,14 @@
1
+ import React from 'react';
2
+ interface ImageItem {
3
+ map?: any;
4
+ length?: ImageItem | undefined;
5
+ url: string;
6
+ book_items_category_id: string | null;
7
+ }
8
+ interface DropImageProps {
9
+ preview?: boolean;
10
+ imageUrls?: ImageItem[];
11
+ setFiles: React.Dispatch<React.SetStateAction<File[]>>;
12
+ }
13
+ export declare const DropImage: React.FC<DropImageProps>;
14
+ export {};
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ interface ErrorContentProps {
3
+ setModal: any;
4
+ errmsg: React.ReactNode | string;
5
+ }
6
+ declare const ErrorContent: React.FC<ErrorContentProps>;
7
+ export default ErrorContent;
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ interface ModalProps {
3
+ modal: React.ReactElement;
4
+ unsetModal?: () => void;
5
+ }
6
+ declare const Modal: React.FC<ModalProps>;
7
+ export default Modal;
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ interface ModalContentProps {
3
+ title?: string;
4
+ setModal?: any;
5
+ children: React.ReactNode;
6
+ onClick?: any;
7
+ notice?: boolean;
8
+ }
9
+ declare const ModalContent: React.FC<ModalContentProps>;
10
+ export default ModalContent;
@@ -0,0 +1,5 @@
1
+ export declare function Spin(props: {
2
+ show: boolean;
3
+ overlayBackground?: 'bg-[#00000055]' | undefined;
4
+ }): import("react/jsx-runtime").JSX.Element | null;
5
+ export default Spin;
@@ -0,0 +1,7 @@
1
+ import { FC } from 'react';
2
+ interface BaseTemplateProps {
3
+ file?: File | null;
4
+ imageUrl?: string;
5
+ }
6
+ declare const BaseTemplate: FC<BaseTemplateProps>;
7
+ export default BaseTemplate;
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ interface CustomUploadProps {
3
+ className?: string;
4
+ children?: React.ReactNode;
5
+ file?: File | null;
6
+ setFile?: any;
7
+ imageUrl?: string;
8
+ }
9
+ export declare const CustomUpload: React.FC<CustomUploadProps>;
10
+ export default CustomUpload;
@@ -0,0 +1 @@
1
+ export declare function HelloServer(): Promise<import("react/jsx-runtime").JSX.Element>;
@@ -0,0 +1,4 @@
1
+ export interface UiLibraryProps {
2
+ }
3
+ export declare function UiLibrary(props: UiLibraryProps): import("react/jsx-runtime").JSX.Element;
4
+ export default UiLibrary;
@@ -0,0 +1,2 @@
1
+ import { type ClassValue } from "clsx";
2
+ export declare function cn(...inputs: ClassValue[]): string;
@@ -0,0 +1 @@
1
+ export * from './lib/hello-server';
package/.eslintrc.json DELETED
@@ -1,18 +0,0 @@
1
- {
2
- "extends": ["plugin:@nx/react", "../.eslintrc.json"],
3
- "ignorePatterns": ["!**/*", "storybook-static"],
4
- "overrides": [
5
- {
6
- "files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
7
- "rules": {}
8
- },
9
- {
10
- "files": ["*.ts", "*.tsx"],
11
- "rules": {}
12
- },
13
- {
14
- "files": ["*.js", "*.jsx"],
15
- "rules": {}
16
- }
17
- ]
18
- }
@@ -1,14 +0,0 @@
1
- const config = {
2
- stories: ['../src/lib/**/*.stories.@(js|jsx|ts|tsx|mdx)'],
3
- addons: ['@storybook/addon-essentials'],
4
- framework: {
5
- name: '@storybook/nextjs',
6
- options: {},
7
- },
8
- };
9
-
10
- export default config;
11
-
12
- // To customize your webpack configuration you can use the webpackFinal field.
13
- // Check https://storybook.js.org/docs/react/builders/webpack#extending-storybooks-webpack-config
14
- // and https://nx.dev/recipes/storybook/custom-builder-configs
@@ -1 +0,0 @@
1
- import './tailwind-imports.css';
@@ -1,81 +0,0 @@
1
- @tailwind base;
2
- @tailwind components;
3
- @tailwind utilities;
4
-
5
- @layer base {
6
- :root {
7
- --background: 0 0% 100%;
8
- --foreground: 222.2 47.4% 11.2%;
9
-
10
- --muted: 210 40% 96.1%;
11
- --muted-foreground: 215.4 16.3% 46.9%;
12
-
13
- --popover: 0 0% 100%;
14
- --popover-foreground: 222.2 47.4% 11.2%;
15
-
16
- --border: 214.3 31.8% 91.4%;
17
- --input: 214.3 31.8% 91.4%;
18
-
19
- --card: 0 0% 100%;
20
- --card-foreground: 222.2 47.4% 11.2%;
21
-
22
- --primary: 222.2 47.4% 11.2%;
23
- --primary-foreground: 210 40% 98%;
24
-
25
- --secondary: 210 40% 96.1%;
26
- --secondary-foreground: 222.2 47.4% 11.2%;
27
-
28
- --accent: 210 40% 96.1%;
29
- --accent-foreground: 222.2 47.4% 11.2%;
30
-
31
- --destructive: 0 100% 50%;
32
- --destructive-foreground: 210 40% 98%;
33
-
34
- --ring: 215 20.2% 65.1%;
35
-
36
- --radius: 0.5rem;
37
- }
38
-
39
- .dark {
40
- --background: 224 71% 4%;
41
- --foreground: 213 31% 91%;
42
-
43
- --muted: 223 47% 11%;
44
- --muted-foreground: 215.4 16.3% 56.9%;
45
-
46
- --accent: 216 34% 17%;
47
- --accent-foreground: 210 40% 98%;
48
-
49
- --popover: 224 71% 4%;
50
- --popover-foreground: 215 20.2% 65.1%;
51
-
52
- --border: 216 34% 17%;
53
- --input: 216 34% 17%;
54
-
55
- --card: 224 71% 4%;
56
- --card-foreground: 213 31% 91%;
57
-
58
- --primary: 210 40% 98%;
59
- --primary-foreground: 222.2 47.4% 1.2%;
60
-
61
- --secondary: 222.2 47.4% 11.2%;
62
- --secondary-foreground: 210 40% 98%;
63
-
64
- --destructive: 0 63% 31%;
65
- --destructive-foreground: 210 40% 98%;
66
-
67
- --ring: 216 34% 17%;
68
-
69
- --radius: 0.5rem;
70
- }
71
- }
72
-
73
- @layer base {
74
- * {
75
- @apply border-border;
76
- }
77
- body {
78
- @apply bg-background text-foreground;
79
- font-feature-settings: 'rlig' 1, 'calt' 1;
80
- }
81
- }
package/components.json DELETED
@@ -1,15 +0,0 @@
1
- {
2
- "$schema": "https://ui.shadcn.com/schema.json",
3
- "style": "new-york",
4
- "rsc": false,
5
- "tailwind": {
6
- "config": "apps/**/tailwind.config.js",
7
- "css": "apps/**/app/global.css",
8
- "baseColor": "stone",
9
- "cssVariables": true
10
- },
11
- "aliases": {
12
- "components": "@sunggang/uiLibrary/components",
13
- "utils": "@sunggang/uiLibrary/lib/utils"
14
- }
15
- }
package/postcss.config.js DELETED
@@ -1,10 +0,0 @@
1
- const { join } = require('path');
2
-
3
- module.exports = {
4
- plugins: {
5
- tailwindcss: {
6
- config: join(__dirname, 'tailwind.config.js'),
7
- },
8
- autoprefixer: {},
9
- },
10
- };
package/project.json DELETED
@@ -1,31 +0,0 @@
1
- {
2
- "name": "uiLibrary",
3
- "$schema": "../node_modules/nx/schemas/project-schema.json",
4
- "sourceRoot": "uiLibrary/src",
5
- "projectType": "library",
6
- "tags": [],
7
- "targets": {
8
- "build": {
9
- "executor": "@nx/rollup:rollup",
10
- "outputs": ["{options.outputPath}"],
11
- "options": {
12
- "outputPath": "dist/uiLibrary",
13
- "styles": ["apps/ui-lib/styles.css"],
14
- "postcssConfig": "apps/ui-lib/postcss.config.js",
15
- "tsConfig": "uiLibrary/tsconfig.lib.json",
16
- "project": "uiLibrary/package.json",
17
- "entryFile": "uiLibrary/src/index.ts",
18
- "external": ["react", "react-dom", "react/jsx-runtime"],
19
- "rollupConfig": "@nx/react/plugins/bundle-rollup",
20
- "compiler": "swc",
21
- "assets": [
22
- {
23
- "glob": "uiLibrary/README.md",
24
- "input": ".",
25
- "output": "."
26
- }
27
- ]
28
- }
29
- }
30
- }
31
- }
@@ -1,27 +0,0 @@
1
- import * as React from "react"
2
- import * as SwitchPrimitives from "@radix-ui/react-switch"
3
-
4
- import { cn } from "@sunggang/uiLibrary/lib/utils"
5
-
6
- const Switch = React.forwardRef<
7
- React.ElementRef<typeof SwitchPrimitives.Root>,
8
- React.ComponentPropsWithoutRef<typeof SwitchPrimitives.Root>
9
- >(({ className, ...props }, ref) => (
10
- <SwitchPrimitives.Root
11
- className={cn(
12
- "peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",
13
- className
14
- )}
15
- {...props}
16
- ref={ref}
17
- >
18
- <SwitchPrimitives.Thumb
19
- className={cn(
20
- "pointer-events-none block h-4 w-4 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0"
21
- )}
22
- />
23
- </SwitchPrimitives.Root>
24
- ))
25
- Switch.displayName = SwitchPrimitives.Root.displayName
26
-
27
- export { Switch }
@@ -1,42 +0,0 @@
1
- import type { Meta, StoryFn } from '@storybook/react';
2
- import { DropImage } from './index';
3
-
4
- interface ImageItem {
5
- map?: any;
6
- length?: ImageItem | undefined;
7
- url: string;
8
- book_items_category_id: string | null;
9
- }
10
-
11
- interface DropImageProps {
12
- preview: boolean;
13
- imageUrls?: ImageItem[];
14
- setFiles: React.Dispatch<React.SetStateAction<File[]>>;
15
- }
16
-
17
- export default {
18
- component: DropImage,
19
- title: 'DropImage',
20
- } as Meta;
21
-
22
- const demoImage: ImageItem[] = [
23
- {
24
- url: 'https://gobobook.s3.ap-northeast-1.amazonaws.com/regions/DEV/region1.png',
25
- book_items_category_id: null,
26
- },
27
- {
28
- url: 'https://gobobook.s3.ap-northeast-1.amazonaws.com/regions/DEV/region2.png',
29
- book_items_category_id: null,
30
- },
31
- ];
32
-
33
- const Template: StoryFn<DropImageProps> = (args) => {
34
- return <DropImage {...args} />;
35
- };
36
-
37
- export const Base = Template.bind({});
38
- Base.args = {
39
- preview: true,
40
- setFiles: () => ({}),
41
- imageUrls: demoImage,
42
- };
@@ -1,110 +0,0 @@
1
- import React, { useState } from 'react';
2
- import { useDropzone } from 'react-dropzone';
3
- import { v4 as uuidv4 } from 'uuid';
4
- import { Icon } from '@iconify/react';
5
-
6
- interface ImageItem {
7
- map?: any;
8
- length?: ImageItem | undefined;
9
- url: string;
10
- book_items_category_id: string | null;
11
- }
12
-
13
- interface DropImageProps {
14
- preview?: boolean;
15
- imageUrls?: ImageItem[];
16
- setFiles: React.Dispatch<React.SetStateAction<File[]>>;
17
- }
18
-
19
- export const DropImage: React.FC<DropImageProps> = ({
20
- preview = true,
21
- setFiles,
22
- imageUrls,
23
- }) => {
24
- const [previewFiles, setPreviewFiles] = useState<File[]>([]);
25
-
26
- const {
27
- getRootProps,
28
- getInputProps,
29
- isDragActive,
30
- isDragAccept,
31
- isDragReject,
32
- } = useDropzone({
33
- accept: { 'image/png': ['.png'], 'image/jpeg': ['.jpg', '.jpeg'] },
34
- maxFiles: 10,
35
- maxSize: 5000000,
36
- onDrop: (dropFiles) => {
37
- const newFiles: File[] = [];
38
-
39
- setFiles(dropFiles);
40
-
41
- dropFiles.forEach((dropFile) => {
42
- Object.assign(dropFile, {
43
- preview: URL.createObjectURL(dropFile),
44
- uuid: uuidv4(),
45
- });
46
- newFiles.push(dropFile);
47
-
48
- setPreviewFiles(newFiles);
49
- });
50
- },
51
- });
52
-
53
- return (
54
- <section className="w-full">
55
- <div {...getRootProps({ className: 'dropzone' })}>
56
- <input {...getInputProps()} />
57
- <div className="flex justify-between">
58
- <div className="w-full bg-gray-light rounded-lg">
59
- <div className="border-2 border-dashed border-gray-400 rounded-lg bg-gray-100">
60
- <div className="flex justify-center py-8">
61
- <Icon
62
- icon="material-symbols:upload"
63
- width="2.5rem"
64
- height="2.5rem"
65
- />
66
- </div>
67
-
68
- <div className="flex items-center flex-col justify-center">
69
- <p className="font-normal text-sm text-gray-400 pb-4">
70
- 圖片僅支援 png、jpg、jpeg
71
- </p>
72
-
73
- <h5 className="mb-2 text-xl font-bold tracking-tight text-gray-700 pb-4">
74
- 拖曳圖片至此
75
- </h5>
76
- </div>
77
- </div>
78
- </div>
79
- </div>
80
- </div>
81
- {preview && (
82
- <div className="flex pt-2 gap-2">
83
- {previewFiles?.length
84
- ? previewFiles.length > 0
85
- ? previewFiles.map((item: any) => (
86
- <div key={item?.uuid}>
87
- <img
88
- className="w-24 h-24 object-cover"
89
- src={item?.preview}
90
- alt=""
91
- />
92
- </div>
93
- ))
94
- : null
95
- : imageUrls && imageUrls.length
96
- ? imageUrls.map((item) => (
97
- <div key={item?.url}>
98
- <img
99
- className="w-24 h-24 object-cover"
100
- src={item?.url}
101
- alt=""
102
- />
103
- </div>
104
- ))
105
- : null}
106
- </div>
107
- )}
108
- </section>
109
- );
110
- };
@@ -1,52 +0,0 @@
1
- import React from 'react';
2
- import PropTypes from 'prop-types';
3
- import { Icon } from '@iconify/react';
4
-
5
- const BaseModal = ({
6
- isOpen = false,
7
- content,
8
- height,
9
- className,
10
- onClose,
11
- showCloseIcon = false,
12
- fixCloseBtn = false,
13
- }) =>
14
- isOpen && (
15
- <div className="fixed top-0 left-0 h-full z-[1000] p-4 duration-300 transition-opacity bg-[#000000b3] w-full">
16
- <div className="w-full h-full flex justify-center items-center relative">
17
- {showCloseIcon && (
18
- <div className="text-right p-2 absolute right-0 top-0">
19
- <Icon
20
- className="ml-auto cursor-pointer text-white"
21
- icon="ion:close"
22
- width="24"
23
- height="24"
24
- onClick={onClose}
25
- />
26
- </div>
27
- )}
28
- <div
29
- className={[
30
- 'bg-white rounded-xl overflow-y-auto m-auto',
31
- fixCloseBtn ? '' : 'max-w-[932px] max-h-[90vh]',
32
- height,
33
- className,
34
- ].join(' ')}
35
- >
36
- {content}
37
- </div>
38
- </div>
39
- </div>
40
- );
41
-
42
- BaseModal.propTypes = {
43
- isOpen: PropTypes.bool,
44
- content: PropTypes.element,
45
- height: PropTypes.string,
46
- className: PropTypes.string,
47
- onClose: PropTypes.func,
48
- showCloseIcon: PropTypes.bool,
49
- fixCloseBtn: PropTypes.bool,
50
- };
51
-
52
- export default BaseModal;
@@ -1,21 +0,0 @@
1
- import React from 'react';
2
- import { Icon } from '@iconify/react';
3
- import ModalContent from './ModalContent';
4
-
5
- interface ErrorContentProps {
6
- setModal: any;
7
- errmsg: React.ReactNode | string;
8
- }
9
-
10
- const ErrorContent: React.FC<ErrorContentProps> = ({ setModal, errmsg }) => (
11
- <ModalContent setModal={setModal} onClick={setModal} notice>
12
- <div className="w-full max-w-xl">
13
- <div className="flex justify-center items-center mb-6">
14
- <Icon icon="fluent-mdl2:status-error-full" color="red" height={60} />
15
- </div>
16
- <div className="text-center text-lg text-gray-500">{errmsg}</div>
17
- </div>
18
- </ModalContent>
19
- );
20
-
21
- export default ErrorContent;
@@ -1,39 +0,0 @@
1
- import { useEffect } from 'react';
2
- import PropTypes from 'prop-types';
3
-
4
- const FullScreenModal = ({ overHidden, isOpen, children }) => {
5
- useEffect(() => {
6
- if (overHidden) return;
7
- // 在 Modal 打開時,禁止滾動
8
- if (isOpen) {
9
- document.body.style.overflow = 'hidden';
10
- } else {
11
- // 在 Modal 關閉時,啟用滾動
12
- document.body.style.overflow = 'visible';
13
- }
14
-
15
- // 在組件卸載時清除樣式
16
- // eslint-disable-next-line consistent-return
17
- return () => {
18
- document.body.style.overflow = 'visible';
19
- };
20
- }, [isOpen]);
21
-
22
- return (
23
- <div
24
- className={`fixed top-0 left-0 w-full h-full overflow-hidden flex items-center justify-center z-[9999] bg-black bg-opacity-10 ${
25
- isOpen ? 'block' : 'hidden'
26
- }`}
27
- >
28
- <div className="modal-content bg-white p-[30px] rounded-lg relative">{children}</div>
29
- </div>
30
- );
31
- };
32
-
33
- FullScreenModal.propTypes = {
34
- isOpen: PropTypes.bool.isRequired,
35
- children: PropTypes.node.isRequired,
36
- overHidden: PropTypes.bool,
37
- };
38
-
39
- export default FullScreenModal;
@@ -1,36 +0,0 @@
1
- import React, { useEffect, KeyboardEvent } from 'react';
2
-
3
- interface ModalProps {
4
- modal: React.ReactElement;
5
- unsetModal?: () => void;
6
- }
7
-
8
- const Modal: React.FC<ModalProps> = ({ modal, unsetModal = () => {} }) => {
9
- const handleKeyUp = (e: any) => {
10
- if (
11
- e.key === 'Escape' &&
12
- !['INPUT', 'SELECT'].includes(
13
- (document.activeElement as HTMLElement)?.tagName
14
- )
15
- ) {
16
- unsetModal();
17
- }
18
- };
19
-
20
- useEffect(() => {
21
- document.addEventListener('keyup', handleKeyUp);
22
- return () => document.removeEventListener('keyup', handleKeyUp);
23
- }, [unsetModal]);
24
-
25
- return (
26
- <div className="fixed top-0 left-0 h-screen z-[2000] transition-opacity duration-300 transition-opacity bg-[#000000b3] w-full">
27
- <div className="w-full h-full flex justify-center items-center p-6">
28
- <div className="bg-white rounded overflow-y-auto w-full m-auto max-w-[455px] rounded-xl">
29
- {modal}
30
- </div>
31
- </div>
32
- </div>
33
- );
34
- };
35
-
36
- export default Modal;