diff --git a/package-lock.json b/package-lock.json index 11a4c674..e76a5f3d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1217,23 +1217,6 @@ "resolved": "https://registry.npmjs.org/@csstools/normalize.css/-/normalize.css-10.1.0.tgz", "integrity": "sha512-ij4wRiunFfaJxjB0BdrYHIH8FxBJpOwNPhhAcunlmPdXudL1WQV1qoP9un6JsEBAgQH+7UXyyjh0g7jTxXK6tg==" }, - "@emotion/cache": { - "version": "11.4.0", - "resolved": "https://registry.npmjs.org/@emotion/cache/-/cache-11.4.0.tgz", - "integrity": "sha512-Zx70bjE7LErRO9OaZrhf22Qye1y4F7iDl+ITjet0J+i+B88PrAOBkKvaAWhxsZf72tDLajwCgfCjJ2dvH77C3g==", - "requires": { - "@emotion/memoize": "^0.7.4", - "@emotion/sheet": "^1.0.0", - "@emotion/utils": "^1.0.0", - "@emotion/weak-memoize": "^0.2.5", - "stylis": "^4.0.3" - } - }, - "@emotion/hash": { - "version": "0.8.0", - "resolved": "https://registry.npmjs.org/@emotion/hash/-/hash-0.8.0.tgz", - "integrity": "sha512-kBJtf7PH6aWwZ6fka3zQ0p6SBYzx4fl1LoZXE2RrnYST9Xljm7WfKJrU4g/Xr3Beg72MLrp1AWNUmuYJTL7Cow==" - }, "@emotion/is-prop-valid": { "version": "0.8.8", "resolved": "https://registry.npmjs.org/@emotion/is-prop-valid/-/is-prop-valid-0.8.8.tgz", @@ -1247,37 +1230,6 @@ "resolved": "https://registry.npmjs.org/@emotion/memoize/-/memoize-0.7.4.tgz", "integrity": "sha512-Ja/Vfqe3HpuzRsG1oBtWTHk2PGZ7GR+2Vz5iYGelAw8dx32K0y7PjVuxK6z1nMpZOqAFsRUPCkK1YjJ56qJlgw==" }, - "@emotion/react": { - "version": "11.4.0", - "resolved": "https://registry.npmjs.org/@emotion/react/-/react-11.4.0.tgz", - "integrity": "sha512-4XklWsl9BdtatLoJpSjusXhpKv9YVteYKh9hPKP1Sxl+mswEFoUe0WtmtWjxEjkA51DQ2QRMCNOvKcSlCQ7ivg==", - "requires": { - "@babel/runtime": "^7.13.10", - "@emotion/cache": "^11.4.0", - "@emotion/serialize": "^1.0.2", - "@emotion/sheet": "^1.0.1", - "@emotion/utils": "^1.0.0", - "@emotion/weak-memoize": "^0.2.5", - "hoist-non-react-statics": "^3.3.1" - } - }, - "@emotion/serialize": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/@emotion/serialize/-/serialize-1.0.2.tgz", - "integrity": "sha512-95MgNJ9+/ajxU7QIAruiOAdYNjxZX7G2mhgrtDWswA21VviYIRP1R5QilZ/bDY42xiKsaktP4egJb3QdYQZi1A==", - "requires": { - "@emotion/hash": "^0.8.0", - "@emotion/memoize": "^0.7.4", - "@emotion/unitless": "^0.7.5", - "@emotion/utils": "^1.0.0", - "csstype": "^3.0.2" - } - }, - "@emotion/sheet": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/@emotion/sheet/-/sheet-1.0.1.tgz", - "integrity": "sha512-GbIvVMe4U+Zc+929N1V7nW6YYJtidj31lidSmdYcWozwoBIObXBnaJkKNDjZrLm9Nc0BR+ZyHNaRZxqNZbof5g==" - }, "@emotion/stylis": { "version": "0.8.5", "resolved": "https://registry.npmjs.org/@emotion/stylis/-/stylis-0.8.5.tgz", @@ -1288,16 +1240,6 @@ "resolved": "https://registry.npmjs.org/@emotion/unitless/-/unitless-0.7.5.tgz", "integrity": "sha512-OWORNpfjMsSSUBVrRBVGECkhWcULOAJz9ZW8uK9qgxD+87M7jHRcvh/A96XXNhXTLmKcoYSQtBEX7lHMO7YRwg==" }, - "@emotion/utils": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/@emotion/utils/-/utils-1.0.0.tgz", - "integrity": "sha512-mQC2b3XLDs6QCW+pDQDiyO/EdGZYOygE8s5N5rrzjSI4M3IejPE/JPndCBwRT9z982aqQNi6beWs1UeayrQxxA==" - }, - "@emotion/weak-memoize": { - "version": "0.2.5", - "resolved": "https://registry.npmjs.org/@emotion/weak-memoize/-/weak-memoize-0.2.5.tgz", - "integrity": "sha512-6U71C2Wp7r5XtFtQzYrW5iKFT67OixrSxjI4MptCHzdSVlgabczzqLe0ZSgnub/5Kp4hSbpDB1tMytZY9pwxxA==" - }, "@eslint/eslintrc": { "version": "0.4.2", "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-0.4.2.tgz", @@ -1911,88 +1853,6 @@ } } }, - "@material-ui/core": { - "version": "4.12.1", - "resolved": "https://registry.npmjs.org/@material-ui/core/-/core-4.12.1.tgz", - "integrity": "sha512-C6hYsjkWCTfBx9FaqxhCZCITBagh7fyCKFtHyvO3tTOcBw6NJaktdhNZ2n82jQdQdgfFvg6OOxi7OOzsAdAcBQ==", - "requires": { - "@babel/runtime": "^7.4.4", - "@material-ui/styles": "^4.11.4", - "@material-ui/system": "^4.12.1", - "@material-ui/types": "5.1.0", - "@material-ui/utils": "^4.11.2", - "@types/react-transition-group": "^4.2.0", - "clsx": "^1.0.4", - "hoist-non-react-statics": "^3.3.2", - "popper.js": "1.16.1-lts", - "prop-types": "^15.7.2", - "react-is": "^16.8.0 || ^17.0.0", - "react-transition-group": "^4.4.0" - } - }, - "@material-ui/styles": { - "version": "4.11.4", - "resolved": "https://registry.npmjs.org/@material-ui/styles/-/styles-4.11.4.tgz", - "integrity": "sha512-KNTIZcnj/zprG5LW0Sao7zw+yG3O35pviHzejMdcSGCdWbiO8qzRgOYL8JAxAsWBKOKYwVZxXtHWaB5T2Kvxew==", - "requires": { - "@babel/runtime": "^7.4.4", - "@emotion/hash": "^0.8.0", - "@material-ui/types": "5.1.0", - "@material-ui/utils": "^4.11.2", - "clsx": "^1.0.4", - "csstype": "^2.5.2", - "hoist-non-react-statics": "^3.3.2", - "jss": "^10.5.1", - "jss-plugin-camel-case": "^10.5.1", - "jss-plugin-default-unit": "^10.5.1", - "jss-plugin-global": "^10.5.1", - "jss-plugin-nested": "^10.5.1", - "jss-plugin-props-sort": "^10.5.1", - "jss-plugin-rule-value-function": "^10.5.1", - "jss-plugin-vendor-prefixer": "^10.5.1", - "prop-types": "^15.7.2" - }, - "dependencies": { - "csstype": { - "version": "2.6.17", - "resolved": "https://registry.npmjs.org/csstype/-/csstype-2.6.17.tgz", - "integrity": "sha512-u1wmTI1jJGzCJzWndZo8mk4wnPTZd1eOIYTYvuEyOQGfmDl3TrabCCfKnOC86FZwW/9djqTl933UF/cS425i9A==" - } - } - }, - "@material-ui/system": { - "version": "4.12.1", - "resolved": "https://registry.npmjs.org/@material-ui/system/-/system-4.12.1.tgz", - "integrity": "sha512-lUdzs4q9kEXZGhbN7BptyiS1rLNHe6kG9o8Y307HCvF4sQxbCgpL2qi+gUk+yI8a2DNk48gISEQxoxpgph0xIw==", - "requires": { - "@babel/runtime": "^7.4.4", - "@material-ui/utils": "^4.11.2", - "csstype": "^2.5.2", - "prop-types": "^15.7.2" - }, - "dependencies": { - "csstype": { - "version": "2.6.17", - "resolved": "https://registry.npmjs.org/csstype/-/csstype-2.6.17.tgz", - "integrity": "sha512-u1wmTI1jJGzCJzWndZo8mk4wnPTZd1eOIYTYvuEyOQGfmDl3TrabCCfKnOC86FZwW/9djqTl933UF/cS425i9A==" - } - } - }, - "@material-ui/types": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/@material-ui/types/-/types-5.1.0.tgz", - "integrity": "sha512-7cqRjrY50b8QzRSYyhSpx4WRw2YuO0KKIGQEVk5J8uoz2BanawykgZGoWEqKm7pVIbzFDN0SpPcVV4IhOFkl8A==" - }, - "@material-ui/utils": { - "version": "4.11.2", - "resolved": "https://registry.npmjs.org/@material-ui/utils/-/utils-4.11.2.tgz", - "integrity": "sha512-Uul8w38u+PICe2Fg2pDKCaIG7kOyhowZ9vjiC1FsVwPABTW8vPPKfF6OvxRq3IiBaI1faOJmgdvMG7rMJARBhA==", - "requires": { - "@babel/runtime": "^7.4.4", - "prop-types": "^15.7.2", - "react-is": "^16.8.0 || ^17.0.0" - } - }, "@nodelib/fs.scandir": { "version": "2.1.5", "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", @@ -2598,14 +2458,6 @@ "@types/react-router": "*" } }, - "@types/react-transition-group": { - "version": "4.4.2", - "resolved": "https://registry.npmjs.org/@types/react-transition-group/-/react-transition-group-4.4.2.tgz", - "integrity": "sha512-KibDWL6nshuOJ0fu8ll7QnV/LVTo3PzQ9aCPnRUYPfX7eZohHwLIdNHj7pftanREzHNP4/nJa8oeM73uSiavMQ==", - "requires": { - "@types/react": "*" - } - }, "@types/resolve": { "version": "0.0.8", "resolved": "https://registry.npmjs.org/@types/resolve/-/resolve-0.0.8.tgz", @@ -4412,11 +4264,6 @@ "resolved": "https://registry.npmjs.org/clone/-/clone-2.1.2.tgz", "integrity": "sha1-G39Ln1kfHo+DZwQBYANFoCiHQ18=" }, - "clsx": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/clsx/-/clsx-1.1.1.tgz", - "integrity": "sha512-6/bPho624p3S2pMyvP5kKBPXnI3ufHLObBFCfgx+LkeR5lg2XYy2hqZqUf45ypD8COn2bhgGJSUE+l5dhNBieA==" - }, "co": { "version": "4.6.0", "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz", @@ -4925,15 +4772,6 @@ } } }, - "css-vendor": { - "version": "2.0.8", - "resolved": "https://registry.npmjs.org/css-vendor/-/css-vendor-2.0.8.tgz", - "integrity": "sha512-x9Aq0XTInxrkuFeHKbYC7zWY8ai7qJ04Kxd9MnvbC1uO5DagxoHQjm4JvG+vCdXOoFtCjbL2XSZfxmoYa9uQVQ==", - "requires": { - "@babel/runtime": "^7.8.3", - "is-in-browser": "^1.0.2" - } - }, "css-what": { "version": "3.4.2", "resolved": "https://registry.npmjs.org/css-what/-/css-what-3.4.2.tgz", @@ -5441,15 +5279,6 @@ "utila": "~0.4" } }, - "dom-helpers": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/dom-helpers/-/dom-helpers-5.2.1.tgz", - "integrity": "sha512-nRCa7CK3VTrM2NmGkIy4cbK7IZlgBE/PYMn55rrXefr5xXDP0LdtfPnblFDoVdcAfslJ7or6iqAUnx0CCGIWQA==", - "requires": { - "@babel/runtime": "^7.8.7", - "csstype": "^3.0.2" - } - }, "dom-serializer": { "version": "0.2.2", "resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-0.2.2.tgz", @@ -7774,11 +7603,6 @@ "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-1.1.1.tgz", "integrity": "sha512-SEQu7vl8KjNL2eoGBLF3+wAjpsNfA9XMlXAYj/3EdaNfAlxKthD1xjEQfGOUhllCGGJVNY34bRr6lPINhNjyZw==" }, - "hyphenate-style-name": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/hyphenate-style-name/-/hyphenate-style-name-1.0.4.tgz", - "integrity": "sha512-ygGZLjmXfPHj+ZWh6LwbC37l43MhfztxetbFCoYTM2VjkIUpeHgSNn7QIyVFj7YQ1Wl9Cbw5sholVJPzWvC2MQ==" - }, "iconv-lite": { "version": "0.4.24", "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", @@ -8122,11 +7946,6 @@ "is-extglob": "^2.1.1" } }, - "is-in-browser": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/is-in-browser/-/is-in-browser-1.1.3.tgz", - "integrity": "sha1-Vv9NtoOgeMYILrldrX3GLh0E+DU=" - }, "is-module": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-module/-/is-module-1.0.0.tgz", @@ -9934,84 +9753,6 @@ "universalify": "^2.0.0" } }, - "jss": { - "version": "10.7.1", - "resolved": "https://registry.npmjs.org/jss/-/jss-10.7.1.tgz", - "integrity": "sha512-5QN8JSVZR6cxpZNeGfzIjqPEP+ZJwJJfZbXmeABNdxiExyO+eJJDy6WDtqTf8SDKnbL5kZllEpAP71E/Lt7PXg==", - "requires": { - "@babel/runtime": "^7.3.1", - "csstype": "^3.0.2", - "is-in-browser": "^1.1.3", - "tiny-warning": "^1.0.2" - } - }, - "jss-plugin-camel-case": { - "version": "10.7.1", - "resolved": "https://registry.npmjs.org/jss-plugin-camel-case/-/jss-plugin-camel-case-10.7.1.tgz", - "integrity": "sha512-+ioIyWvmAfgDCWXsQcW1NMnLBvRinOVFkSYJUgewQ6TynOcSj5F1bSU23B7z0p1iqK0PPHIU62xY1iNJD33WGA==", - "requires": { - "@babel/runtime": "^7.3.1", - "hyphenate-style-name": "^1.0.3", - "jss": "10.7.1" - } - }, - "jss-plugin-default-unit": { - "version": "10.7.1", - "resolved": "https://registry.npmjs.org/jss-plugin-default-unit/-/jss-plugin-default-unit-10.7.1.tgz", - "integrity": "sha512-tW+dfYVNARBQb/ONzBwd8uyImigyzMiAEDai+AbH5rcHg5h3TtqhAkxx06iuZiT/dZUiFdSKlbe3q9jZGAPIwA==", - "requires": { - "@babel/runtime": "^7.3.1", - "jss": "10.7.1" - } - }, - "jss-plugin-global": { - "version": "10.7.1", - "resolved": "https://registry.npmjs.org/jss-plugin-global/-/jss-plugin-global-10.7.1.tgz", - "integrity": "sha512-FbxCnu44IkK/bw8X3CwZKmcAnJqjAb9LujlAc/aP0bMSdVa3/MugKQRyeQSu00uGL44feJJDoeXXiHOakBr/Zw==", - "requires": { - "@babel/runtime": "^7.3.1", - "jss": "10.7.1" - } - }, - "jss-plugin-nested": { - "version": "10.7.1", - "resolved": "https://registry.npmjs.org/jss-plugin-nested/-/jss-plugin-nested-10.7.1.tgz", - "integrity": "sha512-RNbICk7FlYKaJyv9tkMl7s6FFfeLA3ubNIFKvPqaWtADK0KUaPsPXVYBkAu4x1ItgsWx67xvReMrkcKA0jSXfA==", - "requires": { - "@babel/runtime": "^7.3.1", - "jss": "10.7.1", - "tiny-warning": "^1.0.2" - } - }, - "jss-plugin-props-sort": { - "version": "10.7.1", - "resolved": "https://registry.npmjs.org/jss-plugin-props-sort/-/jss-plugin-props-sort-10.7.1.tgz", - "integrity": "sha512-eyd5FhA+J0QrpqXxO7YNF/HMSXXl4pB0EmUdY4vSJI4QG22F59vQ6AHtP6fSwhmBdQ98Qd9gjfO+RMxcE39P1A==", - "requires": { - "@babel/runtime": "^7.3.1", - "jss": "10.7.1" - } - }, - "jss-plugin-rule-value-function": { - "version": "10.7.1", - "resolved": "https://registry.npmjs.org/jss-plugin-rule-value-function/-/jss-plugin-rule-value-function-10.7.1.tgz", - "integrity": "sha512-fGAAImlbaHD3fXAHI3ooX6aRESOl5iBt3LjpVjxs9II5u9tzam7pqFUmgTcrip9VpRqYHn8J3gA7kCtm8xKwHg==", - "requires": { - "@babel/runtime": "^7.3.1", - "jss": "10.7.1", - "tiny-warning": "^1.0.2" - } - }, - "jss-plugin-vendor-prefixer": { - "version": "10.7.1", - "resolved": "https://registry.npmjs.org/jss-plugin-vendor-prefixer/-/jss-plugin-vendor-prefixer-10.7.1.tgz", - "integrity": "sha512-1UHFmBn7hZNsHXTkLLOL8abRl8vi+D1EVzWD4WmLFj55vawHZfnH1oEz6TUf5Y61XHv0smdHabdXds6BgOXe3A==", - "requires": { - "@babel/runtime": "^7.3.1", - "css-vendor": "^2.0.8", - "jss": "10.7.1" - } - }, "jsx-ast-utils": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/jsx-ast-utils/-/jsx-ast-utils-3.2.0.tgz", @@ -11359,11 +11100,6 @@ "ts-pnp": "^1.1.6" } }, - "popper.js": { - "version": "1.16.1-lts", - "resolved": "https://registry.npmjs.org/popper.js/-/popper.js-1.16.1-lts.tgz", - "integrity": "sha512-Kjw8nKRl1m+VrSFCoVGPph93W/qrSO7ZkqPpTf7F4bk/sqcfWK019dWBUpE/fBOsOQY1dks/Bmcbfn1heM/IsA==" - }, "portfinder": { "version": "1.0.28", "resolved": "https://registry.npmjs.org/portfinder/-/portfinder-1.0.28.tgz", @@ -12722,23 +12458,6 @@ "whatwg-fetch": "^3.4.1" } }, - "react-awesome-reveal": { - "version": "3.8.1", - "resolved": "https://registry.npmjs.org/react-awesome-reveal/-/react-awesome-reveal-3.8.1.tgz", - "integrity": "sha512-cB+XubgAa7QJ9ibkHePiVGTOzRKokqdDOP+yLfQtw5uu+xsAR/kwktLntMZev+1GBz2NhlcpbYvKqEbVIkKfLw==", - "requires": { - "@emotion/react": "^11.4.0", - "react-intersection-observer": "^8.32.0", - "react-is": "^17.0.2" - }, - "dependencies": { - "react-is": { - "version": "17.0.2", - "resolved": "https://registry.npmjs.org/react-is/-/react-is-17.0.2.tgz", - "integrity": "sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w==" - } - } - }, "react-dev-utils": { "version": "11.0.4", "resolved": "https://registry.npmjs.org/react-dev-utils/-/react-dev-utils-11.0.4.tgz", @@ -12905,11 +12624,6 @@ "resolved": "https://registry.npmjs.org/react-error-overlay/-/react-error-overlay-6.0.9.tgz", "integrity": "sha512-nQTTcUu+ATDbrSD1BZHr5kgSD4oF8OFjxun8uAaL8RwPBacGBNPf/yAuVVdx17N8XNzRDMrZ9XcKZHCjPW+9ew==" }, - "react-intersection-observer": { - "version": "8.32.0", - "resolved": "https://registry.npmjs.org/react-intersection-observer/-/react-intersection-observer-8.32.0.tgz", - "integrity": "sha512-RlC6FvS3MFShxTn4FHAy904bVjX5Nn4/eTjUkurW0fHK+M/fyQdXuyCy9+L7yjA+YMGogzzSJNc7M4UtfSKvtw==" - }, "react-is": { "version": "16.13.1", "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz", @@ -13045,17 +12759,6 @@ "workbox-webpack-plugin": "5.1.4" } }, - "react-transition-group": { - "version": "4.4.2", - "resolved": "https://registry.npmjs.org/react-transition-group/-/react-transition-group-4.4.2.tgz", - "integrity": "sha512-/RNYfRAMlZwDSr6z4zNKV6xu53/e2BuaBbGhbyYIXTrmgu/bGHzmqOs7mJSJBHy9Ud+ApHx3QjrkKSp1pxvlFg==", - "requires": { - "@babel/runtime": "^7.5.5", - "dom-helpers": "^5.0.1", - "loose-envify": "^1.4.0", - "prop-types": "^15.6.2" - } - }, "read-pkg": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-3.0.0.tgz", @@ -14709,11 +14412,6 @@ } } }, - "stylis": { - "version": "4.0.10", - "resolved": "https://registry.npmjs.org/stylis/-/stylis-4.0.10.tgz", - "integrity": "sha512-m3k+dk7QeJw660eIKRRn3xPF6uuvHs/FFzjX3HQ5ove0qYsiygoAhwn5a3IYKaZPo5LrYD0rfVmtv1gNY1uYwg==" - }, "supports-color": { "version": "5.5.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", diff --git a/package.json b/package.json index 33fcc6e4..95e730a2 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,6 @@ "version": "0.1.0", "private": true, "dependencies": { - "@material-ui/core": "^4.12.1", "@testing-library/jest-dom": "^5.14.1", "@testing-library/react": "^11.2.7", "@testing-library/user-event": "^12.8.3", @@ -16,7 +15,6 @@ "axios": "^0.21.1", "dayjs": "^1.10.6", "react": "^17.0.2", - "react-awesome-reveal": "3.8.1", "react-dom": "^17.0.2", "react-quill": "1.3.5", "react-router-dom": "^5.2.0", diff --git a/src/apis/concert.api.ts b/src/apis/concert.api.ts index 288c6dc5..4679a654 100644 --- a/src/apis/concert.api.ts +++ b/src/apis/concert.api.ts @@ -1,17 +1,12 @@ import { serverAxios } from 'libs/axios'; -import { IConcert, IConcertList } from '../types/concert.type'; -interface IConcertCommentData { - parentID?: string; - text: string; -} - -interface IFetchParameter { - token?: string; - limit?: number; - offset?: number; - keyword?: string; - tag?: string; -} +import { + IConcert, + IConcertCommentData, + IConcertList, + IFetchComment, + IFetchParameter, + IUserConcert, +} from '../types/concert.type'; const PREFIX_URL = '/concert'; @@ -36,7 +31,7 @@ export const getConcertListData = async (token: string): Promise { +export const getConcertData = async (concertID: string): Promise => { try { const data = await serverAxios.get(`${PREFIX_URL}/${concertID}`, { params: { @@ -50,11 +45,11 @@ export const getConcertData = async (concertID: string) => { } } catch (e) { alert(e.response.data.message); - return undefined; + return null; } }; -export const getConcertUserData = async (token: string, concertID: string) => { +export const getConcertUserData = async (token: string, concertID: string): Promise => { try { const data = await serverAxios.get(`${PREFIX_URL}/${concertID}`, { headers: { @@ -71,7 +66,7 @@ export const getConcertUserData = async (token: string, concertID: string) => { } } catch (e) { alert(e.response.data.message); - return undefined; + return null; } }; @@ -103,7 +98,7 @@ export const postConcertComment = async ( token: string, concertID: string | undefined, commentData: IConcertCommentData, -): Promise => { +): Promise => { try { const data = await serverAxios.post(`${PREFIX_URL}/comment/${concertID}`, commentData, { headers: { @@ -121,7 +116,7 @@ export const postConcertComment = async ( } }; -export const postConcertLike = async (token: string, concertID: string) => { +export const postConcertLike = async (token: string, concertID: string): Promise => { try { const data = await serverAxios.post(`${PREFIX_URL}/like/${concertID}`, '', { headers: { @@ -129,19 +124,20 @@ export const postConcertLike = async (token: string, concertID: string) => { }, }); if (data.data.status === 200) { + return data.data.data; } else { - return null; + return false; } } catch (e) { if (e.response.data.status === 400) { return true; } alert(e.response.data.message); - return undefined; + return false; } }; -export const deleteConcertLike = async (token: string, concertID: string) => { +export const deleteConcertLike = async (token: string, concertID: string): Promise => { try { const data = await serverAxios.delete(`${PREFIX_URL}/like/${concertID}`, { headers: { @@ -149,16 +145,17 @@ export const deleteConcertLike = async (token: string, concertID: string) => { }, }); if (data.data.status === 200) { + return data.data.data; } else { - return null; + return false; } } catch (e) { alert(e.response.data.message); - return undefined; + return false; } }; -export const postConcertScrap = async (token: string, concertID: string) => { +export const postConcertScrap = async (token: string, concertID: string): Promise => { try { const data = await serverAxios.post(`${PREFIX_URL}/scrap/${concertID}`, '', { headers: { @@ -166,19 +163,20 @@ export const postConcertScrap = async (token: string, concertID: string) => { }, }); if (data.data.status === 200) { + return data.data.data; } else { - return null; + return false; } } catch (e) { if (e.response.data.message === '이미 스크랩 된 글입니다') { return true; } alert(e.response.data.message); - return undefined; + return false; } }; -export const deleteConcertScrap = async (token: string, concertID: string) => { +export const deleteConcertScrap = async (token: string, concertID: string): Promise => { try { const data = await serverAxios.delete(`${PREFIX_URL}/scrap/${concertID}`, { headers: { @@ -186,11 +184,12 @@ export const deleteConcertScrap = async (token: string, concertID: string) => { }, }); if (data.data.status === 200) { + return data.data.data; } else { - return null; + return false; } } catch (e) { alert(e.response.data.message); - return undefined; + return false; } }; diff --git a/src/apis/notice.api.ts b/src/apis/notice.api.ts index c8553d64..7b7d1d02 100644 --- a/src/apis/notice.api.ts +++ b/src/apis/notice.api.ts @@ -1,17 +1,12 @@ import { serverAxios } from 'libs/axios'; -import { INoticeList, ISearchNoticeList } from '../types/notice.type'; -interface INoticeCommentData { - parentID?: string; - text: string; -} - -interface IFetchParameter { - token?: string; - limit?: number; - offset?: number; - keyword?: string; - tag?: string; -} +import { + IFetchComment, + IFetchParameter, + INotice, + INoticeCommentData, + INoticeList, + ISearchNoticeList, +} from '../types/notice.type'; const PREFIX_URL = '/notice'; @@ -34,11 +29,11 @@ export const getNoticeListData = async ({ limit = 8, offset = 0 }: IFetchParamet } }; -export const getNoticeData = async (noticeID: string) => { +export const getNoticeData = async (noticeID: string): Promise => { try { const data = await serverAxios.get(`${PREFIX_URL}/${noticeID}`, {}); if (data.data.status === 200) { - return data.data.data; + return data.data.data[0]; } else { return null; } @@ -75,7 +70,7 @@ export const postNoticeComment = async ( token: string, noticeID: string | undefined, commentData: INoticeCommentData, -): Promise => { +): Promise => { try { const data = await serverAxios.post(`${PREFIX_URL}/comment/${noticeID}`, commentData, { headers: { @@ -83,7 +78,7 @@ export const postNoticeComment = async ( }, }); if (data.data.status === 200) { - return null; + return data.data.data; } else { return null; } diff --git a/src/apis/user.api.ts b/src/apis/user.api.ts index 5aea03a2..434e5632 100644 --- a/src/apis/user.api.ts +++ b/src/apis/user.api.ts @@ -62,7 +62,7 @@ export const updateUserInfo = async ( body.append('img', img); } body.append('nickname', nickname); - body.append('interest', `[${interest.join()}]`); + body.append('interest', `[${interest.map((item) => `"${item}"`).join(', ')}]`); body.append('gender', String(gender)); body.append('marpolicy', String(marpolicy)); diff --git a/src/assets/images/index.ts b/src/assets/images/index.ts index 927e59e1..2654a52e 100644 --- a/src/assets/images/index.ts +++ b/src/assets/images/index.ts @@ -63,6 +63,7 @@ export { default as NoticeHeaderIcon } from './noticeHeaderIcon.svg'; export { default as PlusIcon } from './plusIcon.svg'; export { default as GreyPlusIcon } from './plusIconGrey.svg'; export { default as GreydfPlusIcon } from './plusIcon_dfdfdf.svg'; +export { default as PrevIcon } from './prevCategoryButton.svg'; export { default as ScrapIcon } from './scrap.svg'; export { default as GrayScrapIcon } from './scrapIcon.svg'; export { default as ScrapFilledIcon } from './scrap_filled.svg'; diff --git a/src/assets/images/prevCategoryButton.svg b/src/assets/images/prevCategoryButton.svg new file mode 100644 index 00000000..0fd03541 --- /dev/null +++ b/src/assets/images/prevCategoryButton.svg @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + diff --git a/src/components/atoms/StyledInput/index.tsx b/src/components/atoms/StyledInput/index.tsx index 6a88020a..30f222f2 100644 --- a/src/components/atoms/StyledInput/index.tsx +++ b/src/components/atoms/StyledInput/index.tsx @@ -1,31 +1,20 @@ import { ErrorIcon } from 'assets/images'; import React, { useState } from 'react'; -import { SStyledInput } from './style'; +import { ErrorImage, ErrorMsg, Input, InputContainer, SStyledInput } from './style'; export interface IProps { name?: string; className?: string; errorMsg?: string; placeHolder?: string; - onChange: (value: string | number) => void; + onChange?: (value: string) => void; isConditionMet: boolean; width: string; height: string; isPw?: boolean; margin?: string; + readOnly?: boolean; } -const conditionMetStyle = { - border: 'double 1px transparent', - backgroundImage: 'linear-gradient(white, white), linear-gradient(to right, #36c8f5,#13e2dd)', - backgroundOrigin: 'border-box', - backgroundClip: 'content-box, border-box', -}; -const conditionNotMetStyle = { - border: 'solid 1px #f66436', -}; -const defaultStyle = { - border: 'solid 1px #c1c1c1', -}; function StyledInput({ name, @@ -37,33 +26,40 @@ function StyledInput({ height, isPw, margin, + readOnly = false, }: IProps): React.ReactElement { - const [isFocused, setIsfocused] = useState(false); + const [isFocused, setIsFocused] = useState(false); + + const handleOnChange = (e: React.ChangeEvent) => { + onChange?.(e.target.value); + }; + + const handleOnFocus = () => { + setIsFocused(true); + }; return ( - -
+ - { - onChange(e.target.value); - }} - onFocus={() => { - setIsfocused(true); - }} + onChange={handleOnChange} + onFocus={handleOnFocus} // onBlur={(e) => { - // setIsfocused(false); + // setIsFocused(false); // }} type={isPw ? 'password' : 'text'} + readOnly={readOnly} /> - {isFocused && !isConditionMet && } -
- {isFocused && !isConditionMet &&
{errorMsg}
} + {isFocused && !isConditionMet && } + + {isFocused && !isConditionMet && {errorMsg}}
); } diff --git a/src/components/atoms/StyledInput/style.ts b/src/components/atoms/StyledInput/style.ts index e953d79c..e8ec87fb 100644 --- a/src/components/atoms/StyledInput/style.ts +++ b/src/components/atoms/StyledInput/style.ts @@ -1,53 +1,73 @@ -import Styled from 'styled-components'; +import Styled, { css } from 'styled-components'; +import { ifProp, palette, theme } from 'styled-tools'; + +export const Input = Styled.input<{ readOnly: boolean }>` + border: none; + ${ifProp('readOnly', theme('font.subhead3'), theme('font.body3'))}; + color: ${ifProp({ readOnly: true }, palette('grayscale', 4), palette('grayscale', 9))}; + background: ${ifProp('readOnly', palette('grayscale', 1))}; + width: 100%; + height: 100%; + padding: 18px 20px; + border-radius: 4px; + :placeholder{ + color: ${palette('grayscale', 2)}; + } + :focus{ + outline: none; + } +`; + +export const InputContainer = Styled.div<{ width: string; height: string; condition: number; readOnly: boolean }>` + /* condition + -1 : 기본 + 0 : 컨디션 X + 1 : 컨디션 O */ + ${(props) => + props.readOnly + ? css` + border: solid 1px ${palette('grayscale', 2)}; + ` + : props.condition == -1 + ? css` + border: solid 1px ${palette('grayscale', 2)}; + ` + : props.condition == 1 + ? css` + border: double 1px transparent; + background-image: linear-gradient(white, white), + linear-gradient(to right, ${palette('primary', 3)}, ${palette('primary', 0)}); + background-origin: border-box; + background-clip: content-box, border-box; + ` + : css` + border: solid 1px ${palette('primary', 6)}; + `}; + border-radius : 4px; + display : flex; + align-items : center; + width : ${(props) => props.width}; + height : ${(props) => props.height}; + margin-bottom : 5px; +`; + +export const ErrorImage = Styled.img` + width : 24px; + height : 24px; + margin-right : 15px; +`; + +export const ErrorMsg = Styled.div` + ${theme('font.body2')}; + text-align : left; + text-align: left; + color: ${palette('primary', 6)}; +`; export const SStyledInput = Styled.div<{ - isConditionMet: boolean; - isFocused: boolean; - width: string; - height: string; margin?: string; }>` display : flex; flex-direction : column; margin : ${(props) => props.margin}; - .input{ - border : none; - font-size : 16px; - color : #0d0d0d; - letter-spacing: -0.5px; - text-align: left; - width : 100%; - height : 100%; - padding: 18px 20px; - border-radius: 4px; - font-style: AppleSDGothicNeo; - - :placeholder{ - color : #c1c1c1; - } - :focus{ - outline : none; - } - &__container{ - border-radius : 4px; - display : flex; - align-items : center; - width : ${(props) => props.width}; - height : ${(props) => props.height}; - margin-bottom : 5px; - } - &__image--error{ - width : 24px; - height : 24px; - margin-right : 15px; - } - &__msg--error{ - text-align : left; - font-size: 14px; - line-height: 1.5; - letter-spacing: -0.5px; - text-align: left; - color: #f66436; - } - } `; diff --git a/src/components/molecules/AdminChallengeCard/index.tsx b/src/components/molecules/AdminChallengeCard/index.tsx index 5190ff4e..abbea19a 100644 --- a/src/components/molecules/AdminChallengeCard/index.tsx +++ b/src/components/molecules/AdminChallengeCard/index.tsx @@ -20,34 +20,34 @@ function AdminChallengeCard({ challengeData }: IProps): React.ReactElement { 오투 회고 챌린지 {challengeData.generation}기 - - {changeDatetoString(challengeData.createdDT, true)} + + {changeDatetoString(challengeData.createdDT, true)} - - + + {changeDatetoString(challengeData.challengeStartDT, true)} ~{' '} {changeDatetoString(challengeData.challengeEndDT, false)} - - + + {changeDatetoString(challengeData.registerStartDT, true)} ~{' '} {changeDatetoString(challengeData.registerEndDT, false)} - - {challengeData.applyNum}명 + + {challengeData.applyNum}명 - - {challengeData.participants}명 + + {challengeData.participants}명 - - {challengeData.postNum}개 + + {challengeData.postNum}개 diff --git a/src/components/molecules/AdminChallengeCard/style.ts b/src/components/molecules/AdminChallengeCard/style.ts index 93c78ccf..0f15221d 100644 --- a/src/components/molecules/AdminChallengeCard/style.ts +++ b/src/components/molecules/AdminChallengeCard/style.ts @@ -1,12 +1,15 @@ import Styled from 'styled-components'; +import { palette, theme } from 'styled-tools'; export const Label = Styled.div` + ${theme('font.body3')}; margin-right : 41px; width : 90px; - color:#6f6f6f; + color:${palette('grayscale', 5)};; `; export const Exp = Styled.div` - color : #6f6f6f; + ${theme('font.subhead3')}; + color : ${palette('grayscale', 5)};; `; export const RowContainer = Styled.div` display : flex; @@ -32,7 +35,7 @@ export const Title = Styled.div` width : 322px; line-height: 1.31; letter-spacing: -0.5px; - color : #3d3d3d; + color : ${palette('grayscale', 7)};; font-size: 32px; font-weight: bold; `; @@ -42,7 +45,7 @@ export const SAdminChallengeCard = Styled.div` align-items : center; border-radius: 18px; box-shadow: 0 0 24px 0 rgba(13, 12, 63, 0.1); - background-color: #ffffff; + background-color: ${palette('grayscale', 0)};; cursor : pointer; width: 402px; height: 484px; diff --git a/src/components/molecules/AdminChallengeOpenForm/index.tsx b/src/components/molecules/AdminChallengeOpenForm/index.tsx index 21e5d117..ecc81282 100644 --- a/src/components/molecules/AdminChallengeOpenForm/index.tsx +++ b/src/components/molecules/AdminChallengeOpenForm/index.tsx @@ -1,160 +1,89 @@ import { StyledInput } from 'components/atoms'; -import React, { useEffect } from 'react'; -import { IChallengeOpen, IConditionMet } from 'types/challenge.type'; +import React from 'react'; +import { IConditionMet } from 'types/challenge.type'; import { PeopleContainer, PeriodContainer, Text, Wrapper, WriteLabel } from './style'; export interface IProps { isConditionMet: IConditionMet; - setIsConditionMet: (value: IConditionMet) => void; - challengeOpenData: IChallengeOpen; - setChallengeOpenData: (value: IChallengeOpen) => void; + handleTitleOnChange: (value: string) => void; + handleChallengeStOnChange: (value: string) => void; + handleChallengeEndOnChange: (value: string) => void; + handleApplyStOnChange: (value: string) => void; + handleApplyEndOnChange: (value: string) => void; + handleNumOnChange: (value: string) => void; } function AdminChallengeOpenForm({ isConditionMet, - setIsConditionMet, - challengeOpenData, - setChallengeOpenData, + handleTitleOnChange, + handleChallengeStOnChange, + handleChallengeEndOnChange, + handleApplyStOnChange, + handleApplyEndOnChange, + handleNumOnChange, }: IProps): React.ReactElement { - const CheckDatePattern = (date: string) => /[0-9]{4}.[0-9]{2}.[0-9]{2}$/.test(date); - - useEffect(() => { - if (challengeOpenData.title !== '') { - setIsConditionMet({ ...isConditionMet, title: true }); - } else { - setIsConditionMet({ ...isConditionMet, title: false }); - } - }, [challengeOpenData.title]); - useEffect(() => { - if (challengeOpenData.peopleNum !== 0) { - setIsConditionMet({ ...isConditionMet, peopleNum: true }); - } else { - setIsConditionMet({ ...isConditionMet, peopleNum: false }); - } - }, [challengeOpenData.peopleNum]); - - useEffect(() => { - if (CheckDatePattern(challengeOpenData.challengePeriod.start)) { - setIsConditionMet({ ...isConditionMet, challengePeriod: { ...isConditionMet.challengePeriod, start: true } }); - } else { - setIsConditionMet({ ...isConditionMet, challengePeriod: { ...isConditionMet.challengePeriod, start: false } }); - } - }, [challengeOpenData.challengePeriod.start]); - useEffect(() => { - if (CheckDatePattern(challengeOpenData.challengePeriod.end)) { - setIsConditionMet({ ...isConditionMet, challengePeriod: { ...isConditionMet.challengePeriod, end: true } }); - } else { - setIsConditionMet({ ...isConditionMet, challengePeriod: { ...isConditionMet.challengePeriod, end: false } }); - } - }, [challengeOpenData.challengePeriod.end]); - useEffect(() => { - if (CheckDatePattern(challengeOpenData.applyPeriod.start)) { - setIsConditionMet({ ...isConditionMet, applyPeriod: { ...isConditionMet.applyPeriod, start: true } }); - } else { - setIsConditionMet({ ...isConditionMet, applyPeriod: { ...isConditionMet.applyPeriod, start: false } }); - } - }, [challengeOpenData.applyPeriod.start]); - useEffect(() => { - if (CheckDatePattern(challengeOpenData.applyPeriod.end)) { - setIsConditionMet({ ...isConditionMet, applyPeriod: { ...isConditionMet.applyPeriod, end: true } }); - } else { - setIsConditionMet({ ...isConditionMet, applyPeriod: { ...isConditionMet.applyPeriod, end: false } }); - } - }, [challengeOpenData.applyPeriod.end]); - return ( - 챌린지 제목 + 챌린지 제목 { - if (typeof value === 'string') setChallengeOpenData({ ...challengeOpenData, title: value }); - }} + onChange={handleTitleOnChange} isConditionMet={isConditionMet.title} margin="0 0 40px 0" /> - 챌린지 기간 + 챌린지 기간 { - if (typeof value === 'string') - setChallengeOpenData({ - ...challengeOpenData, - challengePeriod: { ...challengeOpenData.challengePeriod, start: value }, - }); - }} + onChange={handleChallengeStOnChange} isConditionMet={isConditionMet.challengePeriod.start} margin="0 0 40px 0" /> - ~ + ~ { - if (typeof value === 'string') - setChallengeOpenData({ - ...challengeOpenData, - challengePeriod: { ...challengeOpenData.challengePeriod, end: value }, - }); - }} + onChange={handleChallengeEndOnChange} isConditionMet={isConditionMet.challengePeriod.end} margin="0 0 40px 0" /> - 챌린지 신청 기간 + 챌린지 신청 기간 { - if (typeof value === 'string') - setChallengeOpenData({ - ...challengeOpenData, - applyPeriod: { ...challengeOpenData.applyPeriod, start: value }, - }); - }} + onChange={handleApplyStOnChange} isConditionMet={isConditionMet.applyPeriod.start} margin="0 0 40px 0" /> - ~ + ~ { - if (typeof value === 'string') - setChallengeOpenData({ - ...challengeOpenData, - applyPeriod: { ...challengeOpenData.applyPeriod, end: value }, - }); - }} + onChange={handleApplyEndOnChange} isConditionMet={isConditionMet.applyPeriod.end} margin="0 0 40px 0" /> - 제한 인원 수 + 제한 인원 수 { - if (typeof value === 'string') - if (!isNaN(Number(value))) { - setChallengeOpenData({ ...challengeOpenData, peopleNum: Number(value) }); - } - }} + onChange={handleNumOnChange} isConditionMet={isConditionMet.peopleNum} margin="0 26px 40px 0" /> - 명 + 명 ); diff --git a/src/components/molecules/AdminChallengeOpenForm/style.ts b/src/components/molecules/AdminChallengeOpenForm/style.ts index daa7ea3c..bf689dc2 100644 --- a/src/components/molecules/AdminChallengeOpenForm/style.ts +++ b/src/components/molecules/AdminChallengeOpenForm/style.ts @@ -1,9 +1,11 @@ import { Label } from 'components/atoms'; import Styled from 'styled-components'; +import { palette, theme } from 'styled-tools'; export const WriteLabel = Styled(Label)` + ${theme('font.subhead4')}; width : 100%; - color: #0d0d0d; + color: ${palette('grayscale', 9)}; margin-bottom : 8px; `; @@ -21,9 +23,10 @@ export const PeopleContainer = Styled.div` align-items : flex-start; `; -export const Text = Styled.div` +export const Text = Styled.div<{ font: string }>` + ${(props) => theme(`font.${props.font}`)}; line-height : 60px; - color : #8b8b8b; + color : ${palette('grayscale', 4)}; `; export const Wrapper = Styled.div` diff --git a/src/components/molecules/BadgeCard/index.tsx b/src/components/molecules/BadgeCard/index.tsx index e0ab4a19..ad9b02ba 100644 --- a/src/components/molecules/BadgeCard/index.tsx +++ b/src/components/molecules/BadgeCard/index.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import Styled from 'styled-components'; +import { Exp, Image, SBadgeCard, Title } from './style'; export interface IProps { className?: string; @@ -11,31 +11,11 @@ export interface IProps { function BadgeCard({ title, explain, img }: IProps): React.ReactElement { return ( - -

{title}

-

{explain}

+ + {title} + {explain}
); } -const SBadgeCard = Styled.div` - display : flex; - flex-direction : column; - align-items : center; - .image{ - width : 130px; - height : 130px; - } - .title{ - margin-top: 10px; - margin-bottom : 15px; - color : #555555; - } - .explain{ - text-align : center; - white-space : nowrap; - color : #555555; - } -`; - export default BadgeCard; diff --git a/src/components/molecules/BadgeCard/style.ts b/src/components/molecules/BadgeCard/style.ts new file mode 100644 index 00000000..70f7e4c5 --- /dev/null +++ b/src/components/molecules/BadgeCard/style.ts @@ -0,0 +1,27 @@ +import Styled from 'styled-components'; +import { palette, theme } from 'styled-tools'; + +export const Image = Styled.img` + width : 130px; + height : 130px; +`; + +export const Title = Styled.h1` + ${theme('font.subhead4')}; + margin-top: 10px; + margin-bottom : 15px; + color : ${palette('grayscale', 6)}; +`; + +export const Exp = Styled.p` + ${theme('font.body3')}; + text-align : center; + white-space : nowrap; + color : ${palette('grayscale', 6)}; +`; + +export const SBadgeCard = Styled.div` + display : flex; + flex-direction : column; + align-items : center; +`; diff --git a/src/components/molecules/CategoryButton/style.ts b/src/components/molecules/CategoryButton/style.ts index b643d011..44453cd2 100644 --- a/src/components/molecules/CategoryButton/style.ts +++ b/src/components/molecules/CategoryButton/style.ts @@ -8,7 +8,7 @@ export const CategoryBtn = Styled(Button)<{ isCategoryClicked?: boolean; readMor ${theme('font.subhead3')}; `; -export const CategoryButtonWrapper = Styled(Button)<{ isCategoryClicked?: boolean; readMore?: boolean }>` +export const CategoryButtonWrapper = Styled.div<{ isCategoryClicked?: boolean; readMore?: boolean }>` height: 46px; border-radius: 60px; padding: 12px 30px; diff --git a/src/components/molecules/ChallengeCardBottom/index.tsx b/src/components/molecules/ChallengeCardBottom/index.tsx new file mode 100644 index 00000000..f9cb38d4 --- /dev/null +++ b/src/components/molecules/ChallengeCardBottom/index.tsx @@ -0,0 +1,123 @@ +import { CancelChallengeLike, ChallengeLike } from 'apis'; +import { ClickGoodIcon, CommentCountIcon, LikeFilledIcon } from 'assets/images'; +import React, { useState } from 'react'; +import { useRecoilValue } from 'recoil'; +import { userStatusState } from 'stores/user'; +import { ButtonWrapper, FoldButton, IconWrapper } from './style'; + +interface IProps { + setIsClosed: (value: boolean) => void; + isClosed: boolean; + setIsLoginModalOpen: (value: boolean) => void; + isLike?: boolean; + like: number; + comments?: number; + id: string; +} + +function ChallengeCardBottom({ + setIsClosed, + setIsLoginModalOpen, + like, + isLike, + comments, + id, + isClosed, +}: IProps): React.ReactElement { + const userStatusData = useRecoilValue(userStatusState); + const [countLikes, setCountLikes] = useState(like); + const [likeRender, setLikeRender] = useState(isLike); + const [lookMoreButton, setLookMoreButton] = useState(true); + const [userStateNum, setUserState] = useState(userStatusData ? userStatusData.userType : 0); + + const submitLike = async () => { + if (userStatusData) { + const token = userStatusData.token; + const submitSuccess = await ChallengeLike(token, id); + if (submitSuccess) { + setLikeRender(true); + setCountLikes(countLikes + 1); + } + } + }; + + const cancelLike = async () => { + if (userStatusData) { + const token = userStatusData.token; + const cancelSuccess = await CancelChallengeLike(token, id); + if (cancelSuccess) { + setLikeRender(false); + setCountLikes(countLikes - 1); + } + } + }; + + const foldHandleOnClick = () => { + setLookMoreButton(!lookMoreButton); + setIsClosed(!isClosed); + }; + + const likeCancelHandelOnClick = () => { + cancelLike(); + { + userStateNum === 0 ? setIsLoginModalOpen(true) : setIsLoginModalOpen(false); + } + }; + + const likeSubmitHandelOnClick = () => { + submitLike(); + { + userStateNum === 0 ? setIsLoginModalOpen(true) : setIsLoginModalOpen(false); + } + }; + + return ( + <> + {lookMoreButton === true ? ( + + { + foldHandleOnClick(); + }} + > + 더보기 + + + ) : ( + + { + foldHandleOnClick(); + }} + > + 접기 + + + )} + + {likeRender ? ( + { + likeCancelHandelOnClick(); + }} + alt="" + /> + ) : ( + { + likeSubmitHandelOnClick(); + }} + alt="" + /> + )} +

{countLikes}

+ +

{comments}

+
+ + ); +} + +export default ChallengeCardBottom; diff --git a/src/components/molecules/ChallengeCardBottom/style.ts b/src/components/molecules/ChallengeCardBottom/style.ts new file mode 100644 index 00000000..579fd7f5 --- /dev/null +++ b/src/components/molecules/ChallengeCardBottom/style.ts @@ -0,0 +1,32 @@ +import Styled from 'styled-components'; +import { palette, theme } from 'styled-tools'; + +export const IconWrapper = Styled.div` + padding: 33px 620px 0px 30px; + padding-bottom:50px; + + h2{ + display:inline-block; + margin: 4px 0 3.2px 8px; + width: 60px; + font-size: 18px; + } + img{ + display:inline-block; + width: 24px; + height:24px; + } +`; + +export const ButtonWrapper = Styled.div` + align-items: center; + margin: 0 auto; + padding: 50px 385px 0px 385px; +`; + +export const FoldButton = Styled.button` + border:0; + background: ${palette('grayscale', 0)}; + color: ${palette('primary', 5)}; + ${theme('font.subhead4')}; +`; diff --git a/src/components/molecules/ChallengeCardFold/index.tsx b/src/components/molecules/ChallengeCardFold/index.tsx new file mode 100644 index 00000000..38b0cdf4 --- /dev/null +++ b/src/components/molecules/ChallengeCardFold/index.tsx @@ -0,0 +1,77 @@ +import { getChallengeContent } from 'apis'; +import { ChallengeComment } from 'components/molecules'; +import React, { useCallback, useEffect, useState } from 'react'; +import { useRecoilValue } from 'recoil'; +import { userStatusState } from 'stores/user'; +import { ICommentData } from 'types/challenge.type'; +import { CommentButton, CommentFoldButton } from './style'; + +interface IProps { + id: string; + comments: number; + setIsLoginModalOpen: (value: boolean) => void; +} + +function ChallengeCardFold({ id, comments, setIsLoginModalOpen }: IProps): React.ReactElement { + const userStatusData = useRecoilValue(userStatusState); + const [userStateNum, setUserState] = useState(userStatusData ? userStatusData.userType : 0); + const [isOpenComment, setIsOpenComment] = useState(false); + const [isFoldComment, setIsFoldComment] = useState(true); + const [isCommentListFlag, setIsCommentListFlag] = useState(false); + const [myCommentList, setMyCommentList] = useState(null); + + const getCommentList = useCallback(async () => { + if (userStatusData) { + const data = await getChallengeContent(id, userStatusData.token); + data && setMyCommentList(data.comments); + } + }, [id, userStatusData]); + + useEffect(() => { + getCommentList(); + }, [isCommentListFlag, getCommentList]); + + function commentAuthorization() { + if (userStateNum === 0) { + return setIsLoginModalOpen(true); + } else { + setIsOpenComment(true); + getCommentList(); + } + } + + return ( + <> + {isOpenComment === false ? ( + { + commentAuthorization(); + }} + > + 댓글 펼치기 + + ) : ( +
+ {isFoldComment === false ? null : ( + + )} + { + setIsOpenComment(false); + }} + > + 댓글 접기 + +
+ )} + + ); +} + +export default ChallengeCardFold; diff --git a/src/components/molecules/ChallengeCardFold/style.ts b/src/components/molecules/ChallengeCardFold/style.ts new file mode 100644 index 00000000..377deb9f --- /dev/null +++ b/src/components/molecules/ChallengeCardFold/style.ts @@ -0,0 +1,25 @@ +import Styled from 'styled-components'; +import { palette, theme } from 'styled-tools'; + +export const CommentFoldButton = Styled.button` + + border-radius: 0px 0px 18px 18px; + background: ${palette('grayscale', 7)}; + width: 844px; + height: 63px; + line-height: 22px; + color: ${palette('grayscale', 0)}; + ${theme('font.subhead3')}; +`; + +export const CommentButton = Styled.button` + align-items: center; + border-radius: 0px 0px 18px 18px; + background: ${palette('grayscale', 7)}; + width: 844px; + height: 63px; + text-align: center; + color: ${palette('grayscale', 0)}; + ${theme('font.subhead3')}; + +`; diff --git a/src/components/molecules/ChallengeCardList/index.tsx b/src/components/molecules/ChallengeCardList/index.tsx new file mode 100644 index 00000000..d4861620 --- /dev/null +++ b/src/components/molecules/ChallengeCardList/index.tsx @@ -0,0 +1,30 @@ +import React from 'react'; +import { FormDetailWrapper } from './style'; + +interface IProps { + good?: string; + bad?: string; + learn?: string; + isClosed: boolean; +} + +function ChallengeCardList({ good, bad, learn, isClosed }: IProps): React.ReactElement { + return ( +
+ +

잘한점

+ {isClosed === true ?
{good}
:

{good}

} +
+ +

못한점

+ {isClosed === true ?
{bad}
:

{bad}

} +
+ +

배운점

+ {isClosed === true ?
{learn}
:

{learn}

} +
+
+ ); +} + +export default ChallengeCardList; diff --git a/src/components/molecules/ChallengeCardList/style.ts b/src/components/molecules/ChallengeCardList/style.ts new file mode 100644 index 00000000..e227951e --- /dev/null +++ b/src/components/molecules/ChallengeCardList/style.ts @@ -0,0 +1,26 @@ +import Styled from 'styled-components'; +import { theme } from 'styled-tools'; + +export const FormDetailWrapper = Styled.div` + padding: 30px 30px 0 60px; + + h1{ + text-align: left; + ${theme('font.subhead3')}; + } + h5{ + width:724px; + max-height: 100%; + text-align: left; + ${theme('font.body3')}; + } + h2{ + width:724px; + overflow:hidden; + text-align: left; + text-overflow:ellipsis; + white-space:nowrap; + ${theme('font.body3')}; + } + +`; diff --git a/src/components/molecules/ChallengeCardProfile/index.tsx b/src/components/molecules/ChallengeCardProfile/index.tsx new file mode 100644 index 00000000..1df69cd3 --- /dev/null +++ b/src/components/molecules/ChallengeCardProfile/index.tsx @@ -0,0 +1,184 @@ +import { CancelChallengeScrap, ChallengeScrap } from 'apis'; +import { ColorScrapIcon, DeleteIcon, EditIcon, GrayScrapIcon, MenuBarIcon } from 'assets/images'; +import { Link } from 'components/atoms'; +import dayjs from 'dayjs'; +import React, { useState } from 'react'; +import { useRecoilValue } from 'recoil'; +import { userStatusState } from 'stores/user'; +import { + DeleteBar, + DeleteEditCardButton, + InterestTag, + MenuBarWrapper, + MenuButton, + ProfileDetailWrapper, + ProfileImage, + ProfileWrapper, +} from './style'; + +interface IProps { + setIsDeleteModalOpen: (value: boolean) => void; + setIsLoginModalOpen: (value: boolean) => void; + isMine: boolean; + nickname?: string; + image?: string; + createdAt?: string; + isScrap?: boolean; + interest?: string[]; + id: string; +} + +function ChallengeCardProfile({ + setIsDeleteModalOpen, + setIsLoginModalOpen, + isMine, + nickname, + image, + createdAt, + isScrap, + interest, + id, +}: IProps): React.ReactElement { + const [isMenuBar, setIsMenuBar] = useState(true); + const [scrapRender, setScrapRender] = useState(isScrap); + const userStatusData = useRecoilValue(userStatusState); + const [userStateNum, setUserState] = useState(userStatusData ? userStatusData.userType : 0); + + const timeForToday = (value: any) => { + const today = new Date(); + const timeValue = new Date(value); + + const betweenTime = Math.floor((today.getTime() - timeValue.getTime()) / 1000 / 60); + if (betweenTime < 1) { + return '방금전'; + } else if (betweenTime < 60) { + return `${betweenTime}분전`; + } + + const betweenTimeHour = Math.floor(betweenTime / 60); + if (betweenTimeHour < 24) { + return `${betweenTimeHour}시간전`; + } + + const betweenTimeDay = Math.floor(betweenTime / 60 / 24); + if (betweenTimeDay < 365) { + return dayjs(createdAt).format('YY.MM.DD'); + } + }; + + const submitScrap = async () => { + if (userStatusData) { + const token = userStatusData.token; + const submitSuccess = await ChallengeScrap(token, id); + if (submitSuccess) { + setScrapRender(true); + } + } + }; + + const cancelScrap = async () => { + if (userStatusData) { + const token = userStatusData.token; + const cancelSuccess = await CancelChallengeScrap(token, id); + if (cancelSuccess) { + setScrapRender(false); + } + } + }; + + const scrapCancelHandelOnClick = () => { + cancelScrap(); + userStateNum === 0 ? setIsLoginModalOpen(true) : setIsLoginModalOpen(false); + }; + + const scrapSubmitHandelOnClick = () => { + submitScrap(); + userStateNum === 0 ? setIsLoginModalOpen(true) : setIsLoginModalOpen(false); + }; + + const menuTimer = setTimeout(function () { + setIsMenuBar(true); + }, 8000); + + //userState상태 : + // 0: 비회원, + // 1: 챌린지안하는유저, + // 2: 챌린지하는유저, + // 3: 챌린지하는유저&챌린지종료, + // 4: 관리자 + + return ( +
+ + +
+ +

{nickname}

+

{timeForToday(createdAt)}

+
+ {userStateNum === 0 || userStateNum === 1 || userStateNum === 2 || isMine === false ? ( + scrapRender === false ? ( + + + { + scrapSubmitHandelOnClick(); + }} + /> + + + ) : ( + + + { + scrapCancelHandelOnClick(); + }} + /> + + + ) + ) : isMenuBar === false ? ( + + { + setIsDeleteModalOpen(true); + }} + > + + + + + + + + + ) : ( + + + { + setIsMenuBar(false); + menuTimer; + }} + /> + + + )} +
+ {interest && + interest.map((item, id) => { + return #{item}; + })} +
+
+ ); +} + +export default ChallengeCardProfile; diff --git a/src/components/molecules/ChallengeCardProfile/style.ts b/src/components/molecules/ChallengeCardProfile/style.ts new file mode 100644 index 00000000..8baa05e6 --- /dev/null +++ b/src/components/molecules/ChallengeCardProfile/style.ts @@ -0,0 +1,67 @@ +import Styled from 'styled-components'; +import { palette, theme } from 'styled-tools'; + +export const ProfileDetailWrapper = Styled.div` + display:inline-block; + width: calc(100% - 60px); + + h3{ + display:inline-block; + margin-bottom: 10px; + text-align: left; + ${theme('font.subhead5')}; + } + h4{ + display:inline-block; + align-items: center; + padding-left:10px; + color: ${palette('grayscale', 3)}; + ${theme('font.body2')}; + } +`; + +export const MenuBarWrapper = Styled.div` + display:inline-block; + padding-left: 0px; +`; + +export const DeleteBar = Styled.div` + display:inline-block; +`; + +export const MenuButton = Styled.button` + border:none; + background-color:${palette('grayscale', 0)}; +`; + +export const DeleteEditCardButton = Styled.button` + display:inline-block; + border:none; + background-color:${palette('grayscale', 0)}; + padding: 2px; +`; + +export const ProfileWrapper = Styled.div` + display:inline-block; + width: calc( 100% - 140px); + +`; + +export const InterestTag = Styled.div` + display : inline-block; + align-items: center; + margin-right : 5px; + line-height: 20px; + color: ${palette('grayscale', 5)}; + ${theme('font.subhead2')}; + +`; + +export const ProfileImage = Styled.img` + margin: 0 15px 0px 30px; + border: solid 1px ${palette('grayscale', 0)}; + border-radius: 40px 40px 40px 40px; + background-color: ${palette('grayscale', 1)}; + width: 80px; + height: 80px; +`; diff --git a/src/components/molecules/ChallengeComment/index.tsx b/src/components/molecules/ChallengeComment/index.tsx index a77c2516..ff664338 100644 --- a/src/components/molecules/ChallengeComment/index.tsx +++ b/src/components/molecules/ChallengeComment/index.tsx @@ -6,6 +6,7 @@ import { CommentListWrapper } from './style'; interface IProps { commentList: Array | null; challengeID: string; + comments: number; commentListFlag: boolean; setCommentListFlag: (value: boolean) => void; } @@ -14,6 +15,7 @@ function ChallengeComment({ commentList, challengeID, commentListFlag, + comments, setCommentListFlag, }: IProps): React.ReactElement { return ( @@ -22,6 +24,7 @@ function ChallengeComment({ className="comment__write" isComment={true} //댓글부분 challengeID={challengeID} + comments={comments} commentListFlag={commentListFlag} setCommentListFlag={setCommentListFlag} /> @@ -29,6 +32,7 @@ function ChallengeComment({ void; @@ -20,8 +22,11 @@ function ChallengeCommentWrite({ commentListFlag, setCommentListFlag, parentCommentId, + comments, }: IProps): React.ReactElement { + const [isLoginModalOpen, setIsLoginModalOpen] = useState(false); const userStatusData = useRecoilValue(userStatusState); + const [userStateNum, setUserState] = useState(userStatusData ? userStatusData.userType : 0); const [value, setValue] = useState(''); const handleChange = (event: React.ChangeEvent) => { @@ -29,9 +34,14 @@ function ChallengeCommentWrite({ }; const btnHandler = async (e: React.MouseEvent) => { - e.preventDefault(); - if (isComment) await postComment(); - else await postReComment(); + if (userStateNum === 0) { + e.preventDefault(); + return setIsLoginModalOpen(true); + } else { + e.preventDefault(); + if (isComment) await postComment(); + else await postReComment(); + } }; const postComment = async () => { @@ -56,6 +66,7 @@ function ChallengeCommentWrite({ {isComment ? '댓글 작성' : '답글 작성'} + ); } diff --git a/src/components/molecules/ChallengeDetailCard/index.tsx b/src/components/molecules/ChallengeDetailCard/index.tsx deleted file mode 100644 index 745b4e2c..00000000 --- a/src/components/molecules/ChallengeDetailCard/index.tsx +++ /dev/null @@ -1,387 +0,0 @@ -import { - CancelChallengeLike, - CancelChallengeScrap, - ChallengeLike, - ChallengeScrap, - DeleteChallenge, - getChallengeContent, -} from 'apis'; -import { - ClickGoodIcon, - ColorScrapIcon, - CommentCountIcon, - DeleteIcon, - EditIcon, - GrayScrapIcon, - LikeFilledIcon, - LoginAlertIcon, - MenuBarIcon, -} from 'assets/images'; -import { Modal } from 'components/atoms'; -import { ChallengeComment, DeleteModal } from 'components/molecules'; -import dayjs from 'dayjs'; -import React, { useCallback, useEffect, useState } from 'react'; -import { useHistory } from 'react-router'; -import { useRecoilValue } from 'recoil'; -import { userState, userStatusState } from 'stores/user'; -import { ICommentData } from 'types/challenge.type'; -import { - ButtonWrapper, - CancelButton, - CommentButton, - CommentFoldButton, - Container, - DeleteBar, - DeleteButton, - DeleteEditCardButton, - FoldButton, - FormDetailWrapper, - IconWrapper, - InterestTag, - LoginButtonWrapper, - LoginModalWrapper, - LoginNoticeWrapper, - MainCardWrapper, - MenuBarWrapper, - MenuButton, - ProfileDetailWrapper, - ProfileImage, - ProfileWrapper, -} from './style'; - -interface IProps { - nickname?: string; - image?: string; - createdAt?: string; - interest?: string[]; - good?: string; - bad?: string; - learn?: string; - like: number; - comments?: number; - isLike?: boolean; - isScrap?: boolean; - id: string; - onChange?: () => void; - handleFetch?: (offset: number) => void; -} - -function ChallengeDetailCard({ - nickname, - image, - createdAt, - interest, - good, - bad, - learn, - like, - isLike, - isScrap, - comments, - id, - onChange, - handleFetch, -}: IProps): React.ReactElement { - const history = useHistory(); - const userStatusData = useRecoilValue(userStatusState); - const userData = useRecoilValue(userState); - const [isOpenComment, setIsOpenComment] = useState(false); - const [lookMoreButton, setLookMoreButton] = useState(true); - const [isMenuBar, setIsMenuBar] = useState(true); - const [isFoldComment, setIsFoldComment] = useState(true); - const [isClosed, setIsClosed] = useState(false); - const [countLikes, setCountLikes] = useState(like); - const [myCommentList, setMyCommentList] = useState(null); - const [isCommentListFlag, setIsCommentListFlag] = useState(false); - const [userStateNum, setUserState] = useState(userStatusData ? userStatusData.userType : 0); - const [userStateNickname, setUserStateNickname] = useState(userData ? userData.nickname : 0); - const [isMine, setIsMine] = useState(false); - const [likeRender, setLikeRender] = useState(isLike); - const [scrapRender, setScrapRender] = useState(isScrap); - const [isDeleteModalOpen, setIsDeleteModalOpen] = useState(false); - const [isConfirmLoginModal, setIsConfirmLoginModal] = useState(false); - - const getCommentList = useCallback(async () => { - if (userStatusData) { - const data = await getChallengeContent(id, userStatusData.token); - data && setMyCommentList(data.comments); - } - }, [id, userStatusData]); - - useEffect(() => { - getCommentList(); - }, [isCommentListFlag, getCommentList]); - - useEffect(() => { - setIsMine(nickname === userStateNickname); - document.body.style.overflow = isDeleteModalOpen === true ? 'hidden' : 'unset'; - }, [isDeleteModalOpen, nickname, userStateNickname]); - - const deleteClickHandler = async () => { - if (userStatusData) { - const token = userStatusData?.token; - const data = await DeleteChallenge(id, token); - data && setIsDeleteModalOpen(false); - onChange?.(); - handleFetch?.(0); - } else { - alert('네트워크가 좋지 않습니다'); - } - }; - - const submitLike = async () => { - if (userStatusData) { - const token = userStatusData.token; - const submitSuccess = await ChallengeLike(token, id); - if (submitSuccess) { - setLikeRender(true); - setCountLikes(countLikes + 1); - } - } - }; - - const cancelLike = async () => { - if (userStatusData) { - const token = userStatusData.token; - const cancelSuccess = await CancelChallengeLike(token, id); - if (cancelSuccess) { - setLikeRender(false); - setCountLikes(countLikes - 1); - } - } - }; - - const submitScarp = async () => { - if (userStatusData) { - const token = userStatusData.token; - const submitSuccess = await ChallengeScrap(token, id); - if (submitSuccess) { - setScrapRender(true); - } - } - }; - - const cancelScrap = async () => { - if (userStatusData) { - const token = userStatusData.token; - const cancelSuccess = await CancelChallengeScrap(token, id); - if (cancelSuccess) { - setScrapRender(false); - } - } - }; - - // userState상태 : - // 0: 비회원, - // 1: 챌린지안하는유저 (기간은 신청기간 중) - // 2: 챌린지 안하는 유저 (기간은 신청기간이 아님) - // 3: 챌린지 하는 유저 (기간은 챌린지 중) - // 4: 관리자 - - return ( - <> - - -
- - -
- -

{nickname}

-

{dayjs(createdAt).format('MM.DD')}

-
- {userStateNum === 0 || userStateNum === 1 || userStateNum === 2 || isMine === false ? ( - scrapRender === false ? ( - - - { - submitScarp(); - userStateNum === 0 ? setIsConfirmLoginModal(true) : setIsConfirmLoginModal(false); - }} - /> - - - ) : ( - - - { - cancelScrap(); - userStateNum === 0 ? setIsConfirmLoginModal(true) : setIsConfirmLoginModal(false); - }} - /> - - - ) - ) : isMenuBar === false ? ( - - { - setIsDeleteModalOpen(true); - }} - > - - - { - history.push(`/challenge/edit/${id}`); - }} - > - - - - ) : ( - - - { - setIsMenuBar(false); - }} - /> - - - )} -
- {interest && - interest.map((item, id) => { - return #{item}; - })} -
-
- -

잘한점

- {isClosed === true ?
{good}
:

{good}

} -
- -

못한점

- {isClosed === true ?
{bad}
:

{bad}

} -
- -

배운점

- {isClosed === true ?
{learn}
:

{learn}

} -
- {lookMoreButton === true ? ( - - { - setLookMoreButton(false); - setIsClosed(true); - }} - > - 더보기 - - - ) : ( - - { - setLookMoreButton(true); - setIsClosed(false); - }} - > - 접기 - - - )} - - {likeRender ? ( - { - cancelLike(); - { - userStateNum === 0 ? setIsConfirmLoginModal(true) : setIsConfirmLoginModal(false); - } - }} - alt="" - /> - ) : ( - { - submitLike(); - { - userStateNum === 0 ? setIsConfirmLoginModal(true) : setIsConfirmLoginModal(false); - } - }} - alt="" - /> - )} -

{countLikes}

- -

{comments}

-
- {isOpenComment === false ? ( - { - setIsOpenComment(true); - getCommentList(); - }} - > - 댓글 펼치기 - - ) : ( -
- {isFoldComment === false ? null : ( - - )} - { - setIsOpenComment(false); - }} - > - 댓글 접기 - -
- )} -
-
-
-
- - - - - -

앗!

-

로그인이 필요한 서비스입니다

-
- - { - setIsConfirmLoginModal(false); - }} - > - 취소 - - { - history.push('/login'); - }} - > - 로그인하기 - - -
-
- - ); -} - -export default ChallengeDetailCard; diff --git a/src/components/molecules/ChallengeDetailRegister/index.tsx b/src/components/molecules/ChallengeDetailRegister/index.tsx deleted file mode 100644 index 4b4931fd..00000000 --- a/src/components/molecules/ChallengeDetailRegister/index.tsx +++ /dev/null @@ -1,188 +0,0 @@ -import { getRegistPeriod, SignRegister } from 'apis'; -import { AlertIcon, CautionIcon, ChallengeImg, CheckCircleIcon, CheckIcon, MinusIcon, PlusIcon } from 'assets/images'; -import { Modal } from 'components/atoms'; -import { RegisterHeader } from 'components/molecules'; -import React, { useEffect, useState } from 'react'; -import { useRecoilState } from 'recoil'; -import { userState, userStatusState } from 'stores/user'; -import { IAdminChallengePeriod } from 'types/admin.type'; -import { - BoxWrapper, - CardDetailWrapper, - CardSettingWrapper, - CardWrapper, - CautionWrapper, - ChallengeSetting, - ConfirmDetail, - ConfirmModalWrapper, - Container, - DetailContent, - Header, - ModalButton, - NoticeCardWrapper, - NoticeHeaderWrapper, - RegisterButton, - RegisterImg, - RegisterSubmitWrapper, -} from './style'; - -function ChallengeRegister(): React.ReactElement { - const [userData, setUserData] = useRecoilState(userState); - const [userStatusData, setUserStatusData] = useRecoilState(userStatusState); - const [registerCount, setRegisterCount] = useState(0); - const [isOpenModal, setIsOpenModal] = useState(false); - const [isRegisterSubmit, setIsRegisterSubmit] = useState(false); - const [periodData, setPeriodData] = useState(null); - - function minusCount() { - if (registerCount > 0) { - setRegisterCount(registerCount - 1); - } - } - const handleSubmit = async () => { - const signData = { - challengeCNT: registerCount, - }; - if (userStatusData) { - const getData = await SignRegister(signData, userStatusData.token); - if (getData) { - setIsRegisterSubmit(true); - setIsOpenModal(false); - } else { - setIsOpenModal(false); - } - } - }; - - const dateToString = (date: string): string => { - let month = date.substr(5, 2); - if (month.substr(0, 1) === '0') month = month.substr(1, 1); - let day = date.substr(8, 2); - if (day.substr(0, 1) === '0') day = day.substr(1, 1); - return `${month}월 ${day}일`; - }; - - const getRestDay = (dateString: string): number => { - const date = new Date( - parseInt(dateString.substr(0, 4)), - parseInt(dateString.substr(5, 2)) - 1, - parseInt(dateString.substr(8, 2)), - ); - const today = new Date(); - const rest = Math.ceil((date.getTime() - today.getTime()) / (1000 * 3600 * 24)); - return rest; - }; - const getChallengePeriod = async () => { - const data = await getRegistPeriod(); - data && setPeriodData(data); - }; - useEffect(() => { - getChallengePeriod(); - }, []); - - return periodData ? ( - - -
-

챌린지 설명

- -
- - - - - -

신청기간

-

{getRestDay(periodData.registerEndDT)}일 남음

-

챌린지 기간

-

- {dateToString(periodData.challengeStartDT)} ~ {dateToString(periodData.challengeEndDT)} -

- - -

챌린지 개수 설정

-

2개 이상부터 뱃지 획득 가능

-
- -

{ - minusCount(); - }} - > - -

- {registerCount} -

{ - setRegisterCount(registerCount + 1); - }} - > - -

-
-
- - - -
- - - -

잠깐! 확인하고 신청 완료하세요

-

아래 정보를 확인해주세요

- -

챌린지 기간

-

- {dateToString(periodData.challengeStartDT)}~{dateToString(periodData.challengeEndDT)} -

-

신청자

-

{userData?.nickname}님

-

챌린지 개수

-

{registerCount}개

-
- - -

주의사항

-
-
챌린지 개수 2개를 선택하시면 최종 달성률 80%를 넘더라도 배지를 받을 수 없어요!
-
- - -

주의 사항을 확인했으며 챌린지 신청을 완료합니다.

-
-
-
- {isRegisterSubmit === true ? ( - - - -
신청완료!
-

{userData?.nickname}님 챌린지가 정상적으로

-

신청되었습니다.

-
-
- ) : null} - - - - 오투 챌린지 주의사항 - - -

01

-

주당 회고록 개수 3개 이상 선택 및 80% 이상 달성 시 뱃지 획득이 가능합니다.

-

02

-

본 챌린지 의도와는 다른 광고성 글과 카테고리와 무관한 내용은 무통보 삭제 될 수 있습니다.

-
-
-
- ) : ( -

챌린지 신청기간이 아닙니다

- ); -} -export default ChallengeRegister; diff --git a/src/components/molecules/ChallengeEditCard/index.tsx b/src/components/molecules/ChallengeEditCard/index.tsx deleted file mode 100644 index 5c5863af..00000000 --- a/src/components/molecules/ChallengeEditCard/index.tsx +++ /dev/null @@ -1,375 +0,0 @@ -import { ChallengeEdit, getChallengeContent } from 'apis'; -import { - CharacterBlackIcon, - CharacterColor1Icon, - CharacterColor2Icon, - CharacterColor3Icon, - MoreClickedIcon, -} from 'assets/images'; -import { Button, Modal } from 'components/atoms'; -import React, { useEffect, useState } from 'react'; -import { useHistory } from 'react-router-dom'; -import { useRecoilValue } from 'recoil'; -import { interestList } from 'resources/string'; -import { userStatusState } from 'stores/user'; -import { - BlackButton, - ButtonWrapper, - CharacterStepImg, - CharacterWrapper, - ColorButton, - Header, - InterestTagButton, - ProgressBarStep0, - ProgressBarStep1, - ProgressBarStep2, - ProgressBarStep3, - QuestionWrapper, - TagListWrapper, - TagWrapper, -} from './style'; - -export interface IProps { - description?: string; - className?: string; - value?: string; -} - -type selectedStyle = { - backgroundColor: string; - color: string; -}; - -type selectedStyleLists = { - [key: string]: selectedStyle; -}; - -const selectedInterestStyle: selectedStyleLists = { - '건강 및 피트니스': { backgroundColor: '#6f6f6f', color: '#FFFFFF' }, - '게임': { backgroundColor: '#6f6f6f', color: '#FFFFFF' }, - '교육': { backgroundColor: '#6f6f6f', color: '#FFFFFF' }, - '그래픽 및 디자인': { backgroundColor: '#6f6f6f', color: '#FFFFFF' }, - '금융': { backgroundColor: '#6f6f6f', color: '#FFFFFF' }, - 'K-pop': { backgroundColor: '#6f6f6f', color: '#FFFFFF' }, - '뉴스, 신문': { backgroundColor: '#6f6f6f', color: '#FFFFFF' }, - '데이트': { backgroundColor: '#6f6f6f', color: '#FFFFFF' }, - '날씨': { backgroundColor: '#6f6f6f', color: '#FFFFFF' }, - '네비게이션': { backgroundColor: '#6f6f6f', color: '#FFFFFF' }, - '출판,도서': { backgroundColor: '#6f6f6f', color: '#FFFFFF' }, - '뷰티': { backgroundColor: '#6f6f6f', color: '#FFFFFF' }, - '라이프 스타일': { backgroundColor: '#6f6f6f', color: '#FFFFFF' }, - '만화': { backgroundColor: '#6f6f6f', color: '#FFFFFF' }, - '부동산 / 홈 인테리어': { backgroundColor: '#6f6f6f', color: '#FFFFFF' }, - '사진 및 비디오': { backgroundColor: '#6f6f6f', color: '#FFFFFF' }, - '쇼핑': { backgroundColor: '#6f6f6f', color: '#FFFFFF' }, - '비즈니스': { backgroundColor: '#6f6f6f', color: '#FFFFFF' }, - '생산성': { backgroundColor: '#6f6f6f', color: '#FFFFFF' }, - '소셜 네트워킹': { backgroundColor: '#6f6f6f', color: '#FFFFFF' }, - '스포츠': { backgroundColor: '#6f6f6f', color: '#FFFFFF' }, - '어린이': { backgroundColor: '#6f6f6f', color: '#FFFFFF' }, - 'AR앱': { backgroundColor: '#6f6f6f', color: '#FFFFFF' }, - '여행': { backgroundColor: '#6f6f6f', color: '#FFFFFF' }, - '유틸리티': { backgroundColor: '#6f6f6f', color: '#FFFFFF' }, - '음식 및 음료': { backgroundColor: '#6f6f6f', color: '#FFFFFF' }, - '음악': { backgroundColor: '#6f6f6f', color: '#FFFFFF' }, - '의료': { backgroundColor: '#6f6f6f', color: '#FFFFFF' }, - '기타': { backgroundColor: '#6f6f6f', color: '#FFFFFF' }, -}; -interface IEditCard { - id: string; -} - -function EditCard({ id }: IEditCard): React.ReactElement { - const userStatusData = useRecoilValue(userStatusState); - const history = useHistory(); - const maxByte = 1000; //최대 1000바이트 - const [isBadgeModal, setIsBadgeModal] = useState(false); //뱃지 모달 - const [countProgressBar, setCountProgressBar] = useState(0); //프로그래스바 - - const [byte, setByte] = useState({ - byte1: 0, - byte2: 0, - byte3: 0, - }); - - const [textForm, setTextForm] = useState({ - description1: '', - description2: '', - description3: '', - }); - - const { description1, description2, description3 } = textForm; - const textOnChange = (target: any) => { - const { name, value } = target; - setTextForm({ - ...textForm, - [name]: value, - }); - }; - - const handleSubmit = async (e: any) => { - e.preventDefault(); - setTextForm({ - description1: '', - description2: '', - description3: '', - }); - const editData = { - good: description1, - bad: description2, - learn: description3, - interest: selectedInterest, - }; - if (userStatusData) { - const data = await ChallengeEdit(editData, userStatusData.token, id); - data && history.goBack(); - } - }; - - const progressBarState = () => { - let count = 0; - if (byte.byte1 > 0) { - count++; - } - if (byte.byte2 > 0) { - count++; - } - if (byte.byte3 > 0) { - count++; - } - setCountProgressBar(count); - }; - - const handleTotalOnChange = (e: any) => { - const text_val = e.target.value; //입력한 문자 - const target_byte_name = 'byte' + e.target.name.split('description')[1]; - let str = ''; - let totalByte = stringtoByte(text_val); - - if (totalByte >= maxByte) { - str = text_val.substring(0, maxByte); - e.target.value = str; - totalByte = maxByte; - } - textOnChange(e.target); - setByte({ - ...byte, - [target_byte_name]: totalByte, - }); - }; - const stringtoByte = (value: string) => { - return value.length; - }; - - useEffect(() => { - progressBarState(); - }, [byte]); - useEffect(() => { - getDefaultData(); - }, []); - - const getDefaultData = async () => { - if (userStatusData) { - const data = await getChallengeContent(id, userStatusData.token); - if (data) { - setTextForm({ description1: data.good, description2: data.bad, description3: data.learn }); - setSelectedInterest(data.interest); - setByte({ - byte1: stringtoByte(data.good), - byte2: stringtoByte(data.bad), - byte3: stringtoByte(data.learn), - }); - } - } else { - } - }; - - const [isOpenTag, setIsOpenTag] = useState(false); - const [isClickTag, setIsClickTag] = useState(false); - - const [selectedInterest, setSelectedInterest] = useState([]); - const modalInterestHandler = (interest: string) => { - if (selectedInterest.length === 0) { - setSelectedInterest([interest]); - } - if (selectedInterest.length < 3) { - if (!selectedInterest.includes(interest)) { - setSelectedInterest([...selectedInterest, interest]); - } else { - setSelectedInterest(selectedInterest.filter((v) => v !== interest)); - } - } else { - if (selectedInterest.includes(interest)) { - setSelectedInterest(selectedInterest.filter((v) => v !== interest)); - } - } - }; - - const setInterestButton = (id: any, interest: string) => { - return ( - { - modalInterestHandler(interest); - setIsClickTag(!isClickTag); - }} - style={ - selectedInterestStyle[interest] && selectedInterest.indexOf(interest) > -1 - ? selectedInterestStyle[interest] - : {} - } - > - {interest} - - ); - }; - - return ( - <> -
Learn Myself
- {countProgressBar === 0 ? ( - -
- -

당신의 오늘을 알고싶어요!

-
-
- - . - -
-
- ) : null} - - {countProgressBar === 1 ? ( - -

- -

오호라! 오늘 이런 일이 있었군요!

-

-
- - . - -
-
- ) : null} - {countProgressBar === 2 ? ( - -

- -

우와! 내일의 당신은 더 행복할거에요 :)

-

-
- - . - -
-
- ) : null} - {countProgressBar === 3 ? ( - -

- -

더 성장한 내일의 나를 위해!

-

-
- - . - -
-
- ) : null} - - -

오늘의 잘한 점을 적어보세요.

-

- {byte.byte1}/{maxByte} -

- -
- - -

오늘의 못한 점을 적어보세요.

-

- {byte.byte2}/{maxByte} -

- -
- -

잘한 점/못한 점을 통해 배운 것과 다음에 실천할 것을 적어보세요.

-

- {byte.byte3}/{maxByte} -

- -
- - - 해시태그 -
- {interestList.map((interest, id) => { - if (id < 6) { - return setInterestButton(id, interest); - } - })} - - - - {isOpenTag === true ? ( - - ) : null} - -
-
- - {countProgressBar === 3 ? ( - - 글 올리기 - - ) : ( - - 글 올리기 - - )} - - -
-

뱃지 획득

-

축하합니다! 뱃지 하나가 추가되었습니다

-

마이페이지를 확인해주세요 :)

-
-
- - ); -} - -export default EditCard; diff --git a/src/components/molecules/ChallengeEditCard/style.ts b/src/components/molecules/ChallengeEditCard/style.ts deleted file mode 100644 index 649ff80b..00000000 --- a/src/components/molecules/ChallengeEditCard/style.ts +++ /dev/null @@ -1,198 +0,0 @@ -import { Button } from 'components/atoms'; -import Styled from 'styled-components'; -import { palette, theme } from 'styled-tools'; - -export const Header = Styled.div` - padding-top:100px; - text-align:center; - ${theme('font.dp3_eng')}; -`; -export const InterestTagButton = Styled(Button)` - margin : 12px 5px; - border: solid 1px ${palette('grayscale', 4)}; - border-radius: 60px; - background-color: ${palette('grayscale', 0)}; - padding : 12px 30px; - height : 48px; - color : ${palette('grayscale', 4)}; - ${theme('font.subhead3')}; -`; - -export const CharacterWrapper = Styled.div` - position:sticky; - top:20px; - margin: 0 auto; - background-color: ${palette('grayscale', 0)}; - padding-top:60px; - width:844px; - - img{ - padding-top:29px; - } - p{ - padding-top:12.32px; - padding-bottom: 12px; - ${theme('font.subhead2')}; - color : ${palette('grayscale', 5)}; - } - h1{ - padding-top:29px; - padding-left:200px; - } - h2{ - padding-left:450px; - } - h3{ - text-align:end; - } -`; - -export const QuestionWrapper = Styled.div` - margin: 0 auto; - padding-top:60px; - width:844px; - - h1 { - line-height:38px; - color: ${palette('grayscale', 7)}; - ${theme('font.subhead5')}; - } - - p { - padding-bottom: 30px; - text-align: right; - color: #B1B1B1; - ${theme('font.subhead2_eng')}; - } - - textarea{ - box-sizing: border-box; - align-items: center; - border: 1px solid ${palette('grayscale', 1)}; - padding: 40px 60px 40px 60px; - width: 844px; - height:369px; - resize:none; - ${theme('font.body4')}; - } -`; - -export const TagWrapper = Styled.div` - align-items:center; - margin:0 auto; - padding-top:60px; - width:844px; - text-align: left; - ${theme('font.subhead5')}; - - img{ - padding-bottom:5px; - vertical-align : middle; - } -`; - -export const TagListWrapper = Styled.div` - padding-top:20px; - - button{ - box-sizing: border-box; - border: 1px solid rgba(223, 223, 223, 0.5); - box-shadow: 0px 0px 15px rgba(23, 22, 91, 0.08); - background: ${palette('grayscale', 0)}; - padding: 13px 30px 30px 30px; - } - - -`; - -export const ProgressBarStep0 = Styled.span` - display: inline-block; - background-color: #d6d3d3; - width: 844px; - height: 5px; - - span{ - display: inline-block; - background-color: ${palette('primary', 3)}; - width: 1%; - height: 5px; - } -`; - -export const ProgressBarStep1 = Styled.span` - display: inline-block; - background-color: #d6d3d3; - width: 844px; - height: 5px; - - span{ - display: inline-block; - background-color: ${palette('primary', 3)}; - width: 34%; - height: 5px; - } -`; - -export const ProgressBarStep2 = Styled.span` - display: inline-block; - background-color: #d6d3d3; - width: 844px; - height: 5px; - - span{ - display: inline-block; - background-color: ${palette('primary', 3)}; - width: 67%; - height: 5px; - } -`; - -export const ProgressBarStep3 = Styled.span` - display: inline-block; - background-color: #d6d3d3; - width: 844px; - height: 5px; - - span{ - display: inline-block; - background-color: ${palette('primary', 3)}; - width: 100%; - height: 5px; - } -`; - -export const ButtonWrapper = Styled.div` - align-items: center; - margin: 0 auto; - width:844px; -`; - -export const ColorButton = Styled(Button)` - margin: 0 auto; - margin-top:60px; - border:none; - border-radius: 4px; - width:844px; - height: 60px; - text-align: center; - color: ${palette('grayscale', 0)}; - background: linear-gradient(91.91deg, ${palette('primary', 3)} 7.34%, ${palette('primary', 0)} 90.35%); - ${theme('font.subhead3')}; -`; - -export const BlackButton = Styled(Button)` - margin: 0 auto; - margin-top:60px; - border:none; - border-radius: 4px; - width:844px; - height: 60px; - text-align: center; - color: ${palette('grayscale', 0)}; - background: ${palette('grayscale', 1)}; - ${theme('font.subhead3')}; -`; - -export const CharacterStepImg = Styled.img` - padding-left:55px; -`; diff --git a/src/components/molecules/ChallengeEditForm/index.tsx b/src/components/molecules/ChallengeEditForm/index.tsx new file mode 100644 index 00000000..c826fe9f --- /dev/null +++ b/src/components/molecules/ChallengeEditForm/index.tsx @@ -0,0 +1,56 @@ +import React from 'react'; +import { IByte, ITextForm } from 'types/challenge.type'; +import { QuestionWrapper } from './style'; + +interface IProps { + handleTotalOnChange: (e: React.ChangeEvent) => void; + byte: IByte; + ITextForm: ITextForm; +} + +function ChallengeEditForm({ handleTotalOnChange, byte, ITextForm }: IProps): React.ReactElement { + const maxByte = 1000; //최대 1000바이트 + return ( + <> + +

오늘의 잘한 점을 적어보세요.

+

+ {byte.byte1}/{maxByte} +

+ +
+ + +

오늘의 못한 점을 적어보세요.

+

+ {byte.byte2}/{maxByte} +

+ +
+ +

잘한 점/못한 점을 통해 배운 것과 다음에 실천할 것을 적어보세요.

+

+ {byte.byte3}/{maxByte} +

+ +
+ + ); +} + +export default ChallengeEditForm; diff --git a/src/components/molecules/ChallengeEditForm/style.ts b/src/components/molecules/ChallengeEditForm/style.ts new file mode 100644 index 00000000..82a76467 --- /dev/null +++ b/src/components/molecules/ChallengeEditForm/style.ts @@ -0,0 +1,32 @@ +import Styled from 'styled-components'; +import { palette, theme } from 'styled-tools'; + +export const QuestionWrapper = Styled.div` + margin: 0 auto; + padding-top:60px; + width:844px; + + h1 { + line-height:38px; + color: ${palette('grayscale', 7)}; + ${theme('font.subhead5')}; + } + + p { + padding-bottom: 30px; + text-align: right; + color: #B1B1B1; + ${theme('font.subhead2_eng')}; + } + + textarea{ + box-sizing: border-box; + align-items: center; + border: 1px solid ${palette('grayscale', 1)}; + padding: 40px 60px 40px 60px; + width: 844px; + height:369px; + resize:none; + ${theme('font.body4')}; + } +`; diff --git a/src/components/molecules/ChallengeHeader/index.tsx b/src/components/molecules/ChallengeHeader/index.tsx index ea7a6fcc..ebceda6d 100644 --- a/src/components/molecules/ChallengeHeader/index.tsx +++ b/src/components/molecules/ChallengeHeader/index.tsx @@ -30,8 +30,6 @@ interface IProps { challengeList: IChallengeDataList[] | null; setChallengeList: (value: IChallengeDataList[]) => void; generationNum: string; - isClickedEntire: boolean; - setIsClickedEntire: (value: boolean) => void; } //userState상태 : @@ -41,13 +39,7 @@ interface IProps { // 3: 챌린지하는유저&챌린지종료, // 4: 관리자 -function ChallengeHeader({ - isClickedEntire, - setIsClickedEntire, - challengeList, - setChallengeList, - generationNum, -}: IProps): React.ReactElement { +function ChallengeHeader({ challengeList, setChallengeList, generationNum }: IProps): React.ReactElement { const userStatusData = useRecoilValue(userStatusState); const [selectedCategory, setSelectedCategory] = useState('전체'); const [keyword, setKeyword] = useState(''); @@ -97,13 +89,9 @@ function ChallengeHeader({ }; const reRenderCategory = (category: string) => { - if (category === '전체') { - setSelectedCategory(''); - setIsClickedEntire(!isClickedEntire); - } else { - setSelectedCategory(category); - } + setSelectedCategory(category); }; + const reRenderKeyword = (keyword: string) => { setKeyword(keyword); }; diff --git a/src/components/molecules/ChallengeHeader/style.ts b/src/components/molecules/ChallengeHeader/style.ts index aab71c0a..21b9b02a 100644 --- a/src/components/molecules/ChallengeHeader/style.ts +++ b/src/components/molecules/ChallengeHeader/style.ts @@ -51,8 +51,9 @@ export const HeaderWrapper = Styled.div` } h5{ position: fixed; - top: 807px; + top: 607px; left: 180px; + opacity: 0.07; border-radius:100%; background: ${palette('primary', 5)}; width: 200px; @@ -67,7 +68,7 @@ export const WriteButton = Styled.button` border:none; border-radius:100%; background-color:${palette('grayscale', 0)}; - height:64px; + height:0px; img{ align-items:center; @@ -83,7 +84,7 @@ export const AllFeedButtom = Styled.button` border-radius:100%; background-color:${palette('grayscale', 0)}; padding-bottom: 40px; - height:64px; + height:0px; img{ align-items:center; @@ -98,7 +99,7 @@ export const MyFeedButtom = Styled.button` border:none; border-radius:100%; background-color:${palette('grayscale', 0)}; - height:64px; + height:0px; img{ align-items:center; diff --git a/src/components/molecules/ChallengeProgressBar/index.tsx b/src/components/molecules/ChallengeProgressBar/index.tsx new file mode 100644 index 00000000..d4c17b62 --- /dev/null +++ b/src/components/molecules/ChallengeProgressBar/index.tsx @@ -0,0 +1,78 @@ +import { CharacterBlackIcon, CharacterColor1Icon, CharacterColor2Icon, CharacterColor3Icon } from 'assets/images'; +import React from 'react'; +import { + CharacterStepImg, + CharacterWrapper, + ProgressBarStep0, + ProgressBarStep1, + ProgressBarStep2, + ProgressBarStep3, +} from './style'; + +interface IProps { + countProgressBar: number; +} + +function ChallengeProgressBar({ countProgressBar }: IProps): React.ReactElement { + return ( + <> + {countProgressBar === 0 ? ( + +
+ +

당신의 오늘을 알고싶어요!

+
+
+ + . + +
+
+ ) : null} + + {countProgressBar === 1 ? ( + +

+ +

오호라! 오늘 이런 일이 있었군요!

+

+
+ + . + +
+
+ ) : null} + + {countProgressBar === 2 ? ( + +

+ +

우와! 내일의 당신은 더 행복할거에요 :)

+

+
+ + . + +
+
+ ) : null} + + {countProgressBar === 3 ? ( + +

+ +

더 성장한 내일의 나를 위해!

+

+
+ + . + +
+
+ ) : null} + + ); +} + +export default ChallengeProgressBar; diff --git a/src/components/molecules/ChallengeProgressBar/style.ts b/src/components/molecules/ChallengeProgressBar/style.ts new file mode 100644 index 00000000..58df7ced --- /dev/null +++ b/src/components/molecules/ChallengeProgressBar/style.ts @@ -0,0 +1,91 @@ +import Styled from 'styled-components'; +import { palette, theme } from 'styled-tools'; + +export const CharacterWrapper = Styled.div` + position:sticky; + top:20px; + margin: 0 auto; + background-color: ${palette('grayscale', 0)}; + padding-top:60px; + width:844px; + + img{ + padding-top:29px; + } + p{ + padding-top:12.32px; + padding-bottom: 12px; + ${theme('font.subhead2')}; + color : ${palette('grayscale', 5)}; + } + h1{ + padding-top:29px; + padding-left:200px; + } + h2{ + padding-left:450px; + } + h3{ + text-align:end; + } +`; + +export const ProgressBarStep0 = Styled.span` + display: inline-block; + background-color: #d6d3d3; + width: 844px; + height: 5px; + + span{ + display: inline-block; + background-color: ${palette('primary', 3)}; + width: 1%; + height: 5px; + } +`; + +export const ProgressBarStep1 = Styled.span` + display: inline-block; + background-color: #d6d3d3; + width: 844px; + height: 5px; + + span{ + display: inline-block; + background-color: ${palette('primary', 3)}; + width: 34%; + height: 5px; + } +`; + +export const ProgressBarStep2 = Styled.span` + display: inline-block; + background-color: #d6d3d3; + width: 844px; + height: 5px; + + span{ + display: inline-block; + background-color: ${palette('primary', 3)}; + width: 67%; + height: 5px; + } +`; + +export const ProgressBarStep3 = Styled.span` + display: inline-block; + background-color: #d6d3d3; + width: 844px; + height: 5px; + + span{ + display: inline-block; + background-color: ${palette('primary', 3)}; + width: 100%; + height: 5px; + } +`; + +export const CharacterStepImg = Styled.img` + padding-left:55px; +`; diff --git a/src/components/molecules/ChallengeSingleComment/index.tsx b/src/components/molecules/ChallengeSingleComment/index.tsx index fe8fb955..50d54a14 100644 --- a/src/components/molecules/ChallengeSingleComment/index.tsx +++ b/src/components/molecules/ChallengeSingleComment/index.tsx @@ -7,6 +7,7 @@ interface IProps { commentData: ICommentData; challengeID: string; commentListFlag: boolean; + comments: number; setCommentListFlag: (value: boolean) => void; } @@ -14,9 +15,10 @@ function ChallengeSingleComment({ commentData, challengeID, commentListFlag, + comments, setCommentListFlag, }: IProps): React.ReactElement { - const { childrenComment, _id, userID, text } = commentData; + const { childrenComment, _id, userID, text, isDeleted } = commentData; const [openReply, setOpenReply] = useState(false); const onClickReplyOpen = () => { @@ -28,7 +30,7 @@ function ChallengeSingleComment({

{userID?.nickname}

-

{text}

+

{isDeleted ? '삭제된 댓글입니다.' : text}

{openReply ? '접기' : '답글보기'}
@@ -38,6 +40,7 @@ function ChallengeSingleComment({ className="reply__write" isComment={false} //답글부분 challengeID={challengeID} + comments={comments} commentListFlag={commentListFlag} setCommentListFlag={setCommentListFlag} parentCommentId={_id} @@ -49,6 +52,7 @@ function ChallengeSingleComment({ img={data.userID?.img} nickname={data.userID?.nickname} text={data.text} + isDeleted={data.isDeleted} /> ))} diff --git a/src/components/molecules/ChallengeWriteButton/index.tsx b/src/components/molecules/ChallengeWriteButton/index.tsx new file mode 100644 index 00000000..ea687028 --- /dev/null +++ b/src/components/molecules/ChallengeWriteButton/index.tsx @@ -0,0 +1,25 @@ +import React from 'react'; +import { BlackButton, ButtonWrapper, ColorButton } from './style'; + +interface IProps { + countProgressBar: number; + handleSubmit: (e: React.MouseEvent) => void; +} + +function ChallengeWriteButton({ countProgressBar, handleSubmit }: IProps): React.ReactElement { + return ( + <> + {countProgressBar === 3 ? ( + + 글 올리기 + + ) : ( + + 글 올리기 + + )} + + ); +} + +export default ChallengeWriteButton; diff --git a/src/components/molecules/ChallengeWriteButton/style.ts b/src/components/molecules/ChallengeWriteButton/style.ts new file mode 100644 index 00000000..6ada1ab8 --- /dev/null +++ b/src/components/molecules/ChallengeWriteButton/style.ts @@ -0,0 +1,36 @@ +import { Button } from 'components/atoms'; +import Styled from 'styled-components'; +import { palette, theme } from 'styled-tools'; + +export const ButtonWrapper = Styled.div` + align-items: center; + margin: 0 auto; + width:844px; +`; + +export const ColorButton = Styled(Button)` + + margin: 0 auto; + margin-top:60px; + border:none; + border-radius: 4px; + width:844px; + height: 60px; + text-align: center; + color: ${palette('grayscale', 0)}; + background: linear-gradient(91.91deg, ${palette('primary', 3)} 7.34%, ${palette('primary', 0)} 90.35%); + ${theme('font.subhead3')}; +`; + +export const BlackButton = Styled(Button)` + margin: 0 auto; + margin-top:60px; + border:none; + border-radius: 4px; + width:844px; + height: 60px; + text-align: center; + color: ${palette('grayscale', 0)}; + background: ${palette('grayscale', 1)}; + ${theme('font.subhead3')}; +`; diff --git a/src/components/molecules/ChallengeWriteCard/index.tsx b/src/components/molecules/ChallengeWriteCard/index.tsx deleted file mode 100644 index bdbca91b..00000000 --- a/src/components/molecules/ChallengeWriteCard/index.tsx +++ /dev/null @@ -1,374 +0,0 @@ -import { writeForm } from 'apis'; -import { - CharacterBlackIcon, - CharacterColor1Icon, - CharacterColor2Icon, - CharacterColor3Icon, - MoreClickedIcon, -} from 'assets/images'; -import React, { useCallback, useEffect, useState } from 'react'; -import { useHistory } from 'react-router-dom'; -import { useRecoilValue } from 'recoil'; -import { userStatusState } from 'stores/user'; -import { interestList } from '../../../resources/string'; -import { Button, Modal } from '../../atoms'; -import { - BlackButton, - ButtonWrapper, - CharacterStepImg, - CharacterWrapper, - ColorButton, - Header, - InterestTagButton, - ProgressBarStep0, - ProgressBarStep1, - ProgressBarStep2, - ProgressBarStep3, - QuestionWrapper, - TagListWrapper, - TagWrapper, -} from './style'; - -type selectedStyle = { - backgroundColor: string; - color: string; -}; - -type selectedStyleLists = { - [key: string]: selectedStyle; -}; - -const selectedInterestStyle: selectedStyleLists = { - '건강 및 피트니스': { backgroundColor: '#6f6f6f', color: '#FFFFFF' }, - '게임': { backgroundColor: '#6f6f6f', color: '#FFFFFF' }, - '교육': { backgroundColor: '#6f6f6f', color: '#FFFFFF' }, - '그래픽 및 디자인': { backgroundColor: '#6f6f6f', color: '#FFFFFF' }, - '금융': { backgroundColor: '#6f6f6f', color: '#FFFFFF' }, - 'K-pop': { backgroundColor: '#6f6f6f', color: '#FFFFFF' }, - '뉴스, 신문': { backgroundColor: '#6f6f6f', color: '#FFFFFF' }, - '데이트': { backgroundColor: '#6f6f6f', color: '#FFFFFF' }, - '날씨': { backgroundColor: '#6f6f6f', color: '#FFFFFF' }, - '네비게이션': { backgroundColor: '#6f6f6f', color: '#FFFFFF' }, - '출판,도서': { backgroundColor: '#6f6f6f', color: '#FFFFFF' }, - '뷰티': { backgroundColor: '#6f6f6f', color: '#FFFFFF' }, - '라이프 스타일': { backgroundColor: '#6f6f6f', color: '#FFFFFF' }, - '만화': { backgroundColor: '#6f6f6f', color: '#FFFFFF' }, - '부동산 / 홈 인테리어': { backgroundColor: '#6f6f6f', color: '#FFFFFF' }, - '사진 및 비디오': { backgroundColor: '#6f6f6f', color: '#FFFFFF' }, - '쇼핑': { backgroundColor: '#6f6f6f', color: '#FFFFFF' }, - '비즈니스': { backgroundColor: '#6f6f6f', color: '#FFFFFF' }, - '생산성': { backgroundColor: '#6f6f6f', color: '#FFFFFF' }, - '소셜 네트워킹': { backgroundColor: '#6f6f6f', color: '#FFFFFF' }, - '스포츠': { backgroundColor: '#6f6f6f', color: '#FFFFFF' }, - '어린이': { backgroundColor: '#6f6f6f', color: '#FFFFFF' }, - 'AR앱': { backgroundColor: '#6f6f6f', color: '#FFFFFF' }, - '여행': { backgroundColor: '#6f6f6f', color: '#FFFFFF' }, - '유틸리티': { backgroundColor: '#6f6f6f', color: '#FFFFFF' }, - '음식 및 음료': { backgroundColor: '#6f6f6f', color: '#FFFFFF' }, - '음악': { backgroundColor: '#6f6f6f', color: '#FFFFFF' }, - '의료': { backgroundColor: '#6f6f6f', color: '#FFFFFF' }, - '기타': { backgroundColor: '#6f6f6f', color: '#FFFFFF' }, -}; - -type MyFormProps = { - onChangeForm: (form: { description1: string; description2: string; description3: string }) => void; -}; - -function WriteCard({ onChangeForm }: MyFormProps): React.ReactElement { - const history = useHistory(); - const userStatusData = useRecoilValue(userStatusState); - const [isBadgeModal, setIsBadgeModal] = useState(false); //뱃지 모달 - const [countProgressBar, setCountProgressBar] = useState(0); //프로그래스바 - const maxByte = 1000; //최대 1000바이트 - - const [byte, setByte] = useState({ - byte1: 0, - byte2: 0, - byte3: 0, - }); - - const [textForm, setTextForm] = useState({ - description1: '', - description2: '', - description3: '', - }); - - const { description1, description2, description3 } = textForm; - - const textOnChange = (target: any) => { - const { name, value } = target; - setTextForm({ - ...textForm, - [name]: value, - }); - }; - - const handleSubmit = async (e: any) => { - setUserData({ ...userData, interest: selectedInterest }); - e.preventDefault(); - onChangeForm(textForm); - setTextForm({ - description1: '', - description2: '', - description3: '', - }); - const writeData = { - good: description1, - bad: description2, - learn: description3, - interest: selectedInterest, - }; - if (userStatusData) { - await writeForm(writeData, userStatusData.token); - history.goBack(); - } - }; - - const progressBarState = useCallback(() => { - let count = 0; - if (byte.byte1 > 0) { - count++; - } - if (byte.byte2 > 0) { - count++; - } - if (byte.byte3 > 0) { - count++; - } - setCountProgressBar(count); - }, [byte.byte1, byte.byte2, byte.byte3]); - - const totalOnChange = (e: any) => { - const text_val = e.target.value; //입력한 문자 - const target_byte_name = 'byte' + e.target.name.split('description')[1]; - let str = ''; - let totalByte = 0; - for (let i = 0; i < text_val.length; i++) { - totalByte += 1; - } - - if (totalByte >= maxByte) { - str = text_val.substring(0, maxByte); - e.target.value = str; - totalByte = maxByte; - } - - textOnChange(e.target); - setByte({ - ...byte, - [target_byte_name]: totalByte, - }); - }; - - useEffect(() => { - progressBarState(); - }, [byte, progressBarState]); - - const [isOpenTag, setIsOpenTag] = useState(false); - const [isClickTag, setIsClickTag] = useState(false); - - const [userData, setUserData] = useState({ - interest: [''], - }); - const [selectedInterest, setSelectedInterest] = useState([]); - const modalInterestHandler = (interest: string) => { - if (selectedInterest.length === 0) { - setSelectedInterest([interest]); - } - if (selectedInterest.length < 3) { - if (!selectedInterest.includes(interest)) { - setSelectedInterest([...selectedInterest, interest]); - } else { - setSelectedInterest(selectedInterest.filter((v) => v !== interest)); - } - } else { - if (selectedInterest.includes(interest)) { - setSelectedInterest(selectedInterest.filter((v) => v !== interest)); - } - } - }; - - const setInterestButton = (id: any, interest: string) => { - return ( - { - modalInterestHandler(interest); - setIsClickTag(!isClickTag); - }} - style={ - selectedInterestStyle[interest] && selectedInterest.indexOf(interest) > -1 - ? selectedInterestStyle[interest] - : {} - } - > - {interest} - - ); - }; - - useEffect(() => { - setSelectedInterest(selectedInterest); - }, [selectedInterest]); - - const indextoName = (index: undefined | number) => { - switch (index) { - case 1: - return '1st'; - case 2: - return `2nd`; - case 3: - return `3rd`; - default: - return `${index}th`; - } - }; - - return ( - <> -
Learn Myself {indextoName(userStatusData?.progressGeneration)}
- {countProgressBar === 0 ? ( - -
- -

당신의 오늘을 알고싶어요!

-
-
- - . - -
-
- ) : null} - - {countProgressBar === 1 ? ( - -

- -

오호라! 오늘 이런 일이 있었군요!

-

-
- - . - -
-
- ) : null} - {countProgressBar === 2 ? ( - -

- -

우와! 내일의 당신은 더 행복할거에요 :)

-

-
- - . - -
-
- ) : null} - {countProgressBar === 3 ? ( - -

- -

더 성장한 내일의 나를 위해!

-

-
- - . - -
-
- ) : null} - - -

오늘의 잘한 점을 적어보세요.

-

- {byte.byte1}/{maxByte} -

- -
- -

오늘의 못한 점을 적어보세요.

-

- {byte.byte2}/{maxByte} -

- -
- -

잘한 점/못한 점을 통해 배운 것과 다음에 실천할 것을 적어보세요.

-

- {byte.byte3}/{maxByte} -

- -
- - - 해시태그 -
- {interestList.map((interest, id) => { - if (id < 6) { - return setInterestButton(id, interest); - } - })} - - - - {isOpenTag === true ? ( - - ) : null} - -
-
- - {countProgressBar === 3 ? ( - - 글 올리기 - - ) : ( - - 글 올리기 - - )} - - -
-

뱃지 획득

-

축하합니다! 뱃지 하나가 추가되었습니다

-

마이페이지를 확인해주세요 :)

-
-
- - ); -} - -export default WriteCard; diff --git a/src/components/molecules/ChallengeWriteForm/index.tsx b/src/components/molecules/ChallengeWriteForm/index.tsx new file mode 100644 index 00000000..50edc6bb --- /dev/null +++ b/src/components/molecules/ChallengeWriteForm/index.tsx @@ -0,0 +1,57 @@ +import React from 'react'; +import { IByte, ITextForm } from 'types/challenge.type'; +import { QuestionWrapper } from './style'; + +interface IProps { + totalOnChange: (e: React.ChangeEvent) => void; + byte: IByte; + ITextForm: ITextForm; +} + +function ChallengeWriteForm({ totalOnChange, byte, ITextForm }: IProps): React.ReactElement { + const maxByte = 1000; //최대 1000바이트 + return ( + <> + +

오늘의 잘한 점을 적어보세요.

+

+ {byte.byte1}/{maxByte} +

+ +
+ + +

오늘의 못한 점을 적어보세요.

+

+ {byte.byte2}/{maxByte} +

+ +
+ + +

잘한 점/못한 점을 통해 배운 것과 다음에 실천할 것을 적어보세요.

+

+ {byte.byte3}/{maxByte} +

+ +
+ + ); +} + +export default ChallengeWriteForm; diff --git a/src/components/molecules/ChallengeWriteForm/style.ts b/src/components/molecules/ChallengeWriteForm/style.ts new file mode 100644 index 00000000..82a76467 --- /dev/null +++ b/src/components/molecules/ChallengeWriteForm/style.ts @@ -0,0 +1,32 @@ +import Styled from 'styled-components'; +import { palette, theme } from 'styled-tools'; + +export const QuestionWrapper = Styled.div` + margin: 0 auto; + padding-top:60px; + width:844px; + + h1 { + line-height:38px; + color: ${palette('grayscale', 7)}; + ${theme('font.subhead5')}; + } + + p { + padding-bottom: 30px; + text-align: right; + color: #B1B1B1; + ${theme('font.subhead2_eng')}; + } + + textarea{ + box-sizing: border-box; + align-items: center; + border: 1px solid ${palette('grayscale', 1)}; + padding: 40px 60px 40px 60px; + width: 844px; + height:369px; + resize:none; + ${theme('font.body4')}; + } +`; diff --git a/src/components/molecules/ChallengeWriteInterest/index.tsx b/src/components/molecules/ChallengeWriteInterest/index.tsx new file mode 100644 index 00000000..5e69fa3c --- /dev/null +++ b/src/components/molecules/ChallengeWriteInterest/index.tsx @@ -0,0 +1,132 @@ +import { MoreClickedIcon } from 'assets/images'; +import { Button } from 'components/atoms'; +import React, { useEffect, useState } from 'react'; +import { interestList } from 'resources/string'; +import { InterestTagButton, TagListWrapper, TagWrapper } from './style'; + +interface IProps { + selectedInterest: string[]; + setSelectedInterest: (value: string[]) => void; +} + +type selectedStyle = { + backgroundColor: string; + color: string; +}; + +type selectedStyleLists = { + [key: string]: selectedStyle; +}; + +const selectedInterestStyle: selectedStyleLists = { + '건강 및 피트니스': { backgroundColor: '#6f6f6f', color: '#FFFFFF' }, + '게임': { backgroundColor: '#6f6f6f', color: '#FFFFFF' }, + '교육': { backgroundColor: '#6f6f6f', color: '#FFFFFF' }, + '그래픽 및 디자인': { backgroundColor: '#6f6f6f', color: '#FFFFFF' }, + '금융': { backgroundColor: '#6f6f6f', color: '#FFFFFF' }, + 'K-pop': { backgroundColor: '#6f6f6f', color: '#FFFFFF' }, + '뉴스, 신문': { backgroundColor: '#6f6f6f', color: '#FFFFFF' }, + '데이트': { backgroundColor: '#6f6f6f', color: '#FFFFFF' }, + '날씨': { backgroundColor: '#6f6f6f', color: '#FFFFFF' }, + '네비게이션': { backgroundColor: '#6f6f6f', color: '#FFFFFF' }, + '출판,도서': { backgroundColor: '#6f6f6f', color: '#FFFFFF' }, + '뷰티': { backgroundColor: '#6f6f6f', color: '#FFFFFF' }, + '라이프 스타일': { backgroundColor: '#6f6f6f', color: '#FFFFFF' }, + '만화': { backgroundColor: '#6f6f6f', color: '#FFFFFF' }, + '부동산 / 홈 인테리어': { backgroundColor: '#6f6f6f', color: '#FFFFFF' }, + '사진 및 비디오': { backgroundColor: '#6f6f6f', color: '#FFFFFF' }, + '쇼핑': { backgroundColor: '#6f6f6f', color: '#FFFFFF' }, + '비즈니스': { backgroundColor: '#6f6f6f', color: '#FFFFFF' }, + '생산성': { backgroundColor: '#6f6f6f', color: '#FFFFFF' }, + '소셜 네트워킹': { backgroundColor: '#6f6f6f', color: '#FFFFFF' }, + '스포츠': { backgroundColor: '#6f6f6f', color: '#FFFFFF' }, + '어린이': { backgroundColor: '#6f6f6f', color: '#FFFFFF' }, + 'AR앱': { backgroundColor: '#6f6f6f', color: '#FFFFFF' }, + '여행': { backgroundColor: '#6f6f6f', color: '#FFFFFF' }, + '유틸리티': { backgroundColor: '#6f6f6f', color: '#FFFFFF' }, + '음식 및 음료': { backgroundColor: '#6f6f6f', color: '#FFFFFF' }, + '음악': { backgroundColor: '#6f6f6f', color: '#FFFFFF' }, + '의료': { backgroundColor: '#6f6f6f', color: '#FFFFFF' }, + '기타': { backgroundColor: '#6f6f6f', color: '#FFFFFF' }, +}; + +function ChallengeWriteInterest({ selectedInterest, setSelectedInterest }: IProps) { + const [isOpenTag, setIsOpenTag] = useState(false); + const [isClickTag, setIsClickTag] = useState(false); + + const modalInterestHandler = (interest: string) => { + if (selectedInterest.length === 0) { + setSelectedInterest([interest]); + } + if (selectedInterest.length < 3) { + if (!selectedInterest.includes(interest)) { + setSelectedInterest([...selectedInterest, interest]); + } else { + setSelectedInterest(selectedInterest.filter((v) => v !== interest)); + } + } else { + if (selectedInterest.includes(interest)) { + setSelectedInterest(selectedInterest.filter((v) => v !== interest)); + } + } + setIsClickTag(!isClickTag); + }; + + const setInterestButton = (id: number, interest: string) => { + return ( + { + modalInterestHandler(interest); + }} + style={ + selectedInterestStyle[interest] && selectedInterest.indexOf(interest) > -1 + ? selectedInterestStyle[interest] + : {} + } + > + {interest} + + ); + }; + + useEffect(() => { + setSelectedInterest(selectedInterest); + }, [selectedInterest]); + + return ( + + 해시태그 +
+ {interestList.map((interest, id) => { + if (id < 6) { + return setInterestButton(id, interest); + } + })} + + + + {isOpenTag === true ? ( + + ) : null} + +
+
+ ); +} + +export default ChallengeWriteInterest; diff --git a/src/components/molecules/ChallengeWriteInterest/style.ts b/src/components/molecules/ChallengeWriteInterest/style.ts new file mode 100644 index 00000000..1d7f2be2 --- /dev/null +++ b/src/components/molecules/ChallengeWriteInterest/style.ts @@ -0,0 +1,40 @@ +import { Button } from 'components/atoms'; +import Styled from 'styled-components'; +import { palette, theme } from 'styled-tools'; + +export const InterestTagButton = Styled(Button)` + margin : 12px 5px; + border: solid 1px ${palette('grayscale', 4)}; + border-radius: 60px; + background-color: ${palette('grayscale', 0)}; + padding : 12px 30px; + height : 48px; + color : ${palette('grayscale', 4)}; + ${theme('font.subhead3')}; +`; + +export const TagWrapper = Styled.div` + align-items:center; + margin:0 auto; + padding-top:60px; + width:844px; + text-align: left; + ${theme('font.subhead5')}; + + img{ + padding-bottom:5px; + vertical-align : middle; + } +`; + +export const TagListWrapper = Styled.div` + padding-top:20px; + + button{ + box-sizing: border-box; + border: 1px solid rgba(223, 223, 223, 0.5); + box-shadow: 0px 0px 15px rgba(23, 22, 91, 0.08); + background: ${palette('grayscale', 0)}; + padding: 13px 30px 30px 30px; + } +`; diff --git a/src/components/molecules/CommentWrite/index.tsx b/src/components/molecules/CommentWrite/index.tsx index 3103a134..be218e12 100644 --- a/src/components/molecules/CommentWrite/index.tsx +++ b/src/components/molecules/CommentWrite/index.tsx @@ -2,26 +2,24 @@ import React from 'react'; import { CommentButton, CommentForm, CommentTextArea } from './style'; export interface IProps { - className?: string; value: string; isComment: boolean; - onChange: (e: React.ChangeEvent) => void; - onClick: (e: any) => void; - onSubmit: (e: React.FormEvent) => void; + handleChange: (e: React.ChangeEvent) => void; + handleSubmit: (e: React.MouseEvent) => void; } -function CommentWrite({ value, isComment, onChange, onClick, onSubmit }: IProps): React.ReactElement { +function CommentWrite({ value, isComment, handleChange, handleSubmit }: IProps): React.ReactElement { return ( -
+ - + {isComment ? '댓글 작성' : '답글 작성'} diff --git a/src/components/molecules/Concert/index.tsx b/src/components/molecules/Concert/index.tsx index 12dd85ea..936ccd12 100644 --- a/src/components/molecules/Concert/index.tsx +++ b/src/components/molecules/Concert/index.tsx @@ -11,7 +11,7 @@ interface IProps { title: string; text: string; commentNum: number; - likes: number; + likeNum?: number; onClickFunc: () => void; } @@ -23,7 +23,7 @@ function Concert({ title, text, commentNum, - likes, + likeNum, onClickFunc, }: IProps): React.ReactElement { const interestDivide = interestList?.join(' | '); @@ -40,11 +40,17 @@ function Concert({

- + - -

{likes}

+ {likeNum === undefined ? ( +
+ ) : ( + <> + +

{likeNum}

+ + )}

{commentNum}

diff --git a/src/components/molecules/DeleteModal/style.ts b/src/components/molecules/DeleteModal/style.ts index 921fba5a..d5176618 100644 --- a/src/components/molecules/DeleteModal/style.ts +++ b/src/components/molecules/DeleteModal/style.ts @@ -48,7 +48,8 @@ export const Wrapper = Styled.div` left:0; margin:auto; border-radius: 16px; - background-color: #FFFFFF; + border: solid 1px ${palette('grayscale', 4)}; + background-color: ${palette('grayscale', 0)}; width: 500px; height: 312px; `; diff --git a/src/components/molecules/DropDown/index.tsx b/src/components/molecules/DropDown/index.tsx index b956597d..38625ba4 100644 --- a/src/components/molecules/DropDown/index.tsx +++ b/src/components/molecules/DropDown/index.tsx @@ -1,8 +1,9 @@ import { ArrowDownIcon, ArrowUpIcon } from 'assets/images'; import React, { useEffect, useState } from 'react'; -import { Arrow, Input, Item, Label, Line, ListContainer, SummaryInner, SummaryOuter, SummaryValue } from './style'; +import * as S from './style'; export interface IProps { + title?: string; className?: string; setState: (value: string) => void; state: string; @@ -12,7 +13,7 @@ export interface IProps { isSetting?: boolean; } -function DropDown({ setState, state, defaultMsg, itemList, page, isSetting }: IProps): React.ReactElement { +function DropDown({ title, setState, state, defaultMsg, itemList, page, isSetting }: IProps): React.ReactElement { const [isOpen, setIsOpen] = useState(false); //드롭다운이 열렸는지 const [isChecked, setIsChecked] = useState(false); //값이 선택이 되었는지 const handleOnChange = (e: React.ChangeEvent): void => { @@ -36,32 +37,33 @@ function DropDown({ setState, state, defaultMsg, itemList, page, isSetting }: IP return ( <> - - {title}} + + - {state} - - - + {state} + + + {isOpen && ( - + {itemList.map((item, id) => { return (
- - {id !== itemList.length - 1 && } + + + {item} + + {id !== itemList.length - 1 && }
); })} -
+ )} ); diff --git a/src/components/molecules/DropDown/style.ts b/src/components/molecules/DropDown/style.ts index bdaee3e3..f717f694 100644 --- a/src/components/molecules/DropDown/style.ts +++ b/src/components/molecules/DropDown/style.ts @@ -1,12 +1,18 @@ -import Styled from 'styled-components'; -import { theme } from 'styled-tools'; +import Styled, { css } from 'styled-components'; +import { palette, theme } from 'styled-tools'; + +export const Title = Styled.div` + ${theme('font.subhead4')}; + width: 844px; + margin-bottom: 10px; + color: ${palette('grayscale', 9)}; +`; export const Item = Styled.span<{ page: string }>` - ${theme('font.body1')}; - font-size: 16px; + ${theme('font.body3')}; width : 100%; display: block; - color:${(props) => (props.page === 'adminwrite' ? '#0d0d0d' : '#8b8b8b')}; + color:${(props) => (props.page === 'adminwrite' ? `${palette('grayscale', 9)}` : `${palette('grayscale', 4)}`)}; `; export const SummaryOuter = Styled.div<{ @@ -22,16 +28,18 @@ export const SummaryOuter = Styled.div<{ border-radius: 4px; display : flex; align-items : center; - border : ${(props) => (props.isOpen || props.isChecked ? 'double 1px transparent' : '1px solid #c1c1c1')}; - background-image : ${(props) => props.isOpen || props.isChecked - ? 'linear-gradient(white, white), linear-gradient(to right, #36c8f5,#13e2dd)' - : undefined}; - background-origin : - ${(props) => (props.isOpen || props.isChecked ? 'border-box' : undefined)}; - background-clip : - ${(props) => (props.isOpen || props.isChecked ? 'content-box, border-box' : undefined)}; + ? css` + border: double 1px transparent; + background-image: linear-gradient(white, white), + linear-gradient(to right, ${palette('primary', 3)}, ${palette('primary', 0)}); + background-origin: border-box; + background-clip: content-box, border-box; + ` + : css` + border: 1px solid ${palette('grayscale', 2)}; + `}; position:${(props) => (props.page === 'adminwrite' ? 'relative' : undefined)}; `; @@ -62,7 +70,7 @@ export const Line = Styled.div<{ page: string; isSetting?: boolean }>` padding : 0; width:${(props) => (props.isSetting ? '804px' : props.page === 'adminwrite' ? '100%' : '370px')}; height : 1px; - background-color : #dfdfdf; + background-color : ${palette('grayscale', 1)}; margin : 13px 0 14px 0 ; `; @@ -71,14 +79,14 @@ export const ListContainer = Styled.div<{ page: string; isSetting?: boolean }>` max-height:${(props) => (props.page === 'adminwrite' ? '220px' : undefined)}; overflow:${(props) => (props.page === 'adminwrite' ? 'scroll' : undefined)}; margin-top: 5px; - border: 1px solid #c1c1c1; + border: 1px solid ${palette('grayscale', 2)}; border-radius: 4px; display: flex; flex-direction: column; padding: 20px 18px; position:${(props) => (props.page === 'adminwrite' ? 'absolute' : undefined)}; z-index : 10; - background-color : #ffffff; + background-color : ${palette('grayscale', 0)}; `; export const Label = Styled.label` @@ -92,6 +100,6 @@ export const Input = Styled.input` visibility: hidden; position: absolute; :checked + span { - color: #36c8f5; + color: ${palette('primary', 3)}; } `; diff --git a/src/components/molecules/DropDownMulti/index.tsx b/src/components/molecules/DropDownMulti/index.tsx index 019ce05e..44549a40 100644 --- a/src/components/molecules/DropDownMulti/index.tsx +++ b/src/components/molecules/DropDownMulti/index.tsx @@ -1,16 +1,16 @@ import { ArrowDownIcon, ArrowUpIcon } from 'assets/images'; import React, { useEffect, useState } from 'react'; -import { Arrow, Input, Item, Label, Line, ListContainer, SummaryInner, SummaryOuter, SummaryValue } from './style'; +import * as S from './style'; export interface IProps { - className?: string; + title?: string; setState: (value: string) => void; state: string[]; defaultMsg: string; itemList: string[]; } -function DropDown({ setState, state, defaultMsg, itemList }: IProps): React.ReactElement { +function DropDownMulti({ title, setState, state, defaultMsg, itemList }: IProps): React.ReactElement { const [isOpen, setIsOpen] = useState(false); //드롭다운이 열렸는지 const [isChecked, setIsChecked] = useState(false); //값이 선택이 되었는지 const handleOnChange = (e: React.ChangeEvent): void => { @@ -31,29 +31,30 @@ function DropDown({ setState, state, defaultMsg, itemList }: IProps): React.Reac return ( <> - - - {state.length === 0 ? defaultMsg : state.join(', ')} - - - + {title && 카테고리} + + + {state.length === 0 ? defaultMsg : state.join(', ')} + + + {isOpen && ( - + {itemList.map((item, id) => { return (
- - {id !== itemList.length - 1 && } + + + {item} + + {id !== itemList.length - 1 && }
); })} -
+ )} ); } -export default DropDown; +export default DropDownMulti; diff --git a/src/components/molecules/DropDownMulti/style.ts b/src/components/molecules/DropDownMulti/style.ts index b9ad69d8..beb1950a 100644 --- a/src/components/molecules/DropDownMulti/style.ts +++ b/src/components/molecules/DropDownMulti/style.ts @@ -1,12 +1,19 @@ -import Styled from 'styled-components'; -import { theme } from 'styled-tools'; +import Styled, { css } from 'styled-components'; +import { palette, theme } from 'styled-tools'; + +export const Title = Styled.div` + ${theme('font.subhead4')}; + width: 844px; + margin-bottom: 10px; + color: ${palette('grayscale', 9)}; +`; export const Item = Styled.span` ${theme('font.body1')}; font-size: 16px; - width : 100%; + width: 100%; display: block; - color: #8b8b8b; + color: ${palette('grayscale', 4)}; `; export const SummaryOuter = Styled.div<{ @@ -20,16 +27,18 @@ export const SummaryOuter = Styled.div<{ border-radius: 4px; display : flex; align-items : center; - border : ${(props) => (props.isOpen || props.isChecked ? 'double 1px transparent' : '1px solid #c1c1c1')}; - background-image : ${(props) => props.isOpen || props.isChecked - ? 'linear-gradient(white, white), linear-gradient(to right, #36c8f5,#13e2dd)' - : undefined}; - background-origin : - ${(props) => (props.isOpen || props.isChecked ? 'border-box' : undefined)}; - background-clip : - ${(props) => (props.isOpen || props.isChecked ? 'content-box, border-box' : undefined)}; + ? css` + border: double 1px transparent; + background-image: linear-gradient(white, white), + linear-gradient(to right, ${palette('primary', 3)}, ${palette('primary', 0)}); + background-origin: border-box; + background-clip: content-box, border-box; + ` + : css` + border: 1px solid ${palette('grayscale', 1)}; + `}; `; export const SummaryInner = Styled.div` @@ -44,7 +53,7 @@ export const SummaryInner = Styled.div` export const SummaryValue = Styled.div<{ state: string[] }>` ${theme('font.body1')}; font-size: 16px; - color: ${(props) => props.state.length === 0 && '#c1c1c1'}; + color: ${(props) => props.state.length === 0 && `${palette('grayscale', 2)}`}; `; export const Arrow = Styled.img` @@ -56,7 +65,7 @@ export const Line = Styled.div` padding : 0; width:804px; height : 1px; - background-color : #dfdfdf; + background-color : ${palette('grayscale', 1)}; margin : 13px 0 14px 0 ; `; @@ -64,13 +73,13 @@ export const ListContainer = Styled.div` width:844px; height: 212px; margin-top: 5px; - border: 1px solid #c1c1c1; + border: 1px solid ${palette('grayscale', 2)}; border-radius: 4px; display: flex; flex-direction: column; padding: 20px 18px; z-index : 10; - background-color : #ffffff; + background-color : ${palette('grayscale', 0)}; overflow-y: scroll; ::-webkit-scrollbar { width: 4px; @@ -82,12 +91,12 @@ export const ListContainer = Styled.div` } /* Handle */ ::-webkit-scrollbar-thumb { - background: #dfdfdf; + background: ${palette('grayscale', 1)}; border-radius: 20px; } /* Handle on hover */ ::-webkit-scrollbar-thumb:hover { - background: #c1c1c1; + background: ${palette('grayscale', 2)}; } `; @@ -102,6 +111,6 @@ export const Input = Styled.input` visibility: hidden; position: absolute; :checked + span { - color: #36c8f5; + color: ${palette('primary', 3)}; } `; diff --git a/src/components/molecules/FindPwdForm/index.tsx b/src/components/molecules/FindPwdForm/index.tsx index 549823ad..a88f99e1 100644 --- a/src/components/molecules/FindPwdForm/index.tsx +++ b/src/components/molecules/FindPwdForm/index.tsx @@ -75,7 +75,7 @@ function FindPWDForm({ setData, isConditionMet, setIsConditionMet, errMsg }: IPr width="258px" height="60px" onChange={(value) => { - if (typeof value === 'string') setEmail(value); + setEmail(value); }} isConditionMet={isConditionMet.email} errorMsg={emailErrMsg} @@ -90,7 +90,7 @@ function FindPWDForm({ setData, isConditionMet, setIsConditionMet, errMsg }: IPr width="406px" height="60px" onChange={(value) => { - if (typeof value === 'string') setCertifiNum(value); + setCertifiNum(value); }} isConditionMet={isConditionMet.certifiNum} errorMsg={errMsg} diff --git a/src/components/molecules/FindPwdForm/style.ts b/src/components/molecules/FindPwdForm/style.ts index c0ff8b89..5f6cbe44 100644 --- a/src/components/molecules/FindPwdForm/style.ts +++ b/src/components/molecules/FindPwdForm/style.ts @@ -1,5 +1,4 @@ -import { Button } from '@material-ui/core'; -import { Label } from 'components/atoms'; +import { Button, Label } from 'components/atoms'; import Styled from 'styled-components'; import { palette, theme } from 'styled-tools'; diff --git a/src/components/molecules/FormInput/index.tsx b/src/components/molecules/FormInput/index.tsx new file mode 100644 index 00000000..c7ce13fb --- /dev/null +++ b/src/components/molecules/FormInput/index.tsx @@ -0,0 +1,50 @@ +import { StyledInput } from 'components/atoms'; +import React from 'react'; +import * as S from './style'; + +interface IProps { + title: string; + width: string; + height: string; + isConditionMet: boolean; + onChange?: (value: string) => void; + placeHolder?: string; + errorMsg?: string; + readOnly?: boolean; + isPw?: boolean; + margin?: string; +} + +function FormInput({ + title, + width, + height, + isConditionMet, + placeHolder, + onChange, + errorMsg, + readOnly, + isPw, + margin, +}: IProps): React.ReactElement { + return ( + + {title} + + + + + ); +} + +export default FormInput; diff --git a/src/components/molecules/FormInput/style.ts b/src/components/molecules/FormInput/style.ts new file mode 100644 index 00000000..641d9278 --- /dev/null +++ b/src/components/molecules/FormInput/style.ts @@ -0,0 +1,15 @@ +import Styled from 'styled-components'; +import { palette, theme } from 'styled-tools'; + +export const FormInputContainer = Styled.div``; + +export const InputWrapper = Styled.div` + margin-bottom: 50px; +`; + +export const Title = Styled.div` + ${theme('font.subhead4')}; + width: 844px; + margin-bottom: 10px; + color: ${palette('grayscale', 9)}; +`; diff --git a/src/components/molecules/HamDropDown/style.ts b/src/components/molecules/HamDropDown/style.ts index ce834d9c..07934abf 100644 --- a/src/components/molecules/HamDropDown/style.ts +++ b/src/components/molecules/HamDropDown/style.ts @@ -1,6 +1,6 @@ import { Button } from 'components/atoms'; import Styled from 'styled-components'; -import { theme } from 'styled-tools'; +import { palette, theme } from 'styled-tools'; export const LabelIcon = Styled.img` width: 20px; @@ -25,7 +25,7 @@ export const Title = Styled(Button)` display : flex; align-items : center; justify-content : center; -color : #3d3d3d; +color : ${palette('grayscale', 7)}; `; export const Detail = Styled.div` @@ -57,12 +57,12 @@ width: 0.3rem; background: none; } ::-webkit-scrollbar-thumb { - background: #c1c1c1; + background: ${palette('grayscale', 2)}; border-radius: 0.5rem; box-sizing: border-box; } ::-webkit-scrollbar-thumb:hover { - background: #c1c1c1; + background: ${palette('grayscale', 2)}; } `; @@ -70,7 +70,7 @@ export const DetailBtn = Styled(Button)` ${theme('font.body2_eng')} height: 18px; margin: 5px 0; -color : #8b8b8b; +color : ${palette('grayscale', 4)}; white-space: nowrap; :hover{ ${theme('font.subhead2_eng')}; @@ -85,7 +85,7 @@ line-height : 30px; export const Hide = Styled.div` width : 100%; height : 36px; -background-image: linear-gradient(to bottom, rgba(255, 255, 255, 0), #ffffff); +background-image: linear-gradient(to bottom, rgba(255, 255, 255, 0), ${palette('grayscale', 0)}); position : absolute; bottom : 0px; `; diff --git a/src/components/molecules/LoginForm/index.tsx b/src/components/molecules/LoginForm/index.tsx deleted file mode 100644 index e0bf6334..00000000 --- a/src/components/molecules/LoginForm/index.tsx +++ /dev/null @@ -1,116 +0,0 @@ -import { getUserData, postLogin } from 'apis'; -import { StyledInput } from 'components/atoms'; -import React, { useEffect, useState } from 'react'; -import { useHistory } from 'react-router-dom'; -import { useRecoilState } from 'recoil'; -import { userState, userStatusState } from 'stores/user'; -import { LoginBtn, LoginformWrap } from './style'; - -function LoginForm(): React.ReactElement { - const history = useHistory(); - const [loginData, setLoginData] = useState({ - // 값 저장 - email: '', - password: '', - }); - const [userStatusData, setUserStatusData] = useRecoilState(userStatusState); - const [userData, setUserData] = useRecoilState(userState); - const [isConditionMet, setIsConditionMet] = useState({ - email: true, - pwd: true, - }); - const errMsg = { - email: '가입되지 않은 이메일입니다', - pwd: '비밀번호를 다시 확인해 주세요', - }; - - const handleLoginBtn = async () => { - const token = await getUserStatusData(); - const isSuccess = await getUserDetailData(token); - isSuccess && history.push('/'); - }; - useEffect(() => { - if (userStatusData && userData) { - alert('이미 로그인이 되어있습니다. '); - history.push('/'); - } - }, []); - - const getUserStatusData = async () => { - const data = await postLogin(loginData); - if (data) { - if (data.status === 200) { - setUserStatusData({ - token: data.token, - userType: data.data.userState, - totalGeneration: data.data.totalGeneration, - registGeneration: data.data.registGeneration, - progressGeneration: data.data.progressGeneration ? data.data.progressGeneration : 0, - }); - return data.token; - } else { - if (data.message === '아이디가 존재하지 않습니다') { - setIsConditionMet({ email: false, pwd: true }); - } else if (data.message === '비밀번호가 틀렸습니다') { - setIsConditionMet({ email: true, pwd: false }); - } - } - } else { - alert('네트워크가 좋지 않습니다'); - } - return ''; - }; - const getUserDetailData = async (token: string): Promise => { - if (token) { - const data = await getUserData(token); - if (data !== undefined) { - setUserData({ - interest: data.interest, - marpolicy: data.marpolicy, - img: data.img, - _id: data._id, - email: data.email, - nickname: data.nickname, - gender: data.gender, - }); - return true; - } else { - alert('네트워크가 좋지 않습니다'); - } - } - return false; - }; - - return ( - - { - if (typeof value === 'string') setLoginData({ ...loginData, email: value }); - }} - isConditionMet={isConditionMet.email} - errorMsg={errMsg.email} - /> - { - if (typeof value === 'string') setLoginData({ ...loginData, password: value }); - }} - isConditionMet={isConditionMet.pwd} - errorMsg={errMsg.pwd} - /> - - 로그인 - - - ); -} - -export default LoginForm; diff --git a/src/components/molecules/LoginForm/style.ts b/src/components/molecules/LoginForm/style.ts deleted file mode 100644 index 4a076dde..00000000 --- a/src/components/molecules/LoginForm/style.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { Button } from 'components/atoms'; -import Styled from 'styled-components'; - -export const LoginformWrap = Styled.div` - display : flex; - flex-direction : column; - align-items : center; -`; -export const LoginBtn = Styled(Button)` - margin-top : 14px; - border-radius: 4px; - background-image: linear-gradient(to right, #36c8f5,#13e2dd ); - width: 406px; - height: 60px; - color : #ffffff; - font-size : 16px; - font-weight : bold; -`; diff --git a/src/components/molecules/LoginModal/style.ts b/src/components/molecules/LoginModal/style.ts index de3bdb96..45d6c43e 100644 --- a/src/components/molecules/LoginModal/style.ts +++ b/src/components/molecules/LoginModal/style.ts @@ -12,7 +12,7 @@ export const LoginNotice = Styled.div` `; export const LoginNoticeTitle = Styled.div` - padding:20px 0px 20px 0px; + padding:30px 0px 30px 0px; text-align: center; color: #000000; ${theme('font.dp4')}; @@ -25,8 +25,10 @@ export const LoginNoticeDetail = Styled.div` `; export const ButtonContainer = Styled.div` - padding-top:50px; + padding:50px 100px 0px 100px; text-align: center; + justify-content : space-between; + display:flex; `; export const CancelButton = Styled(Button)` @@ -35,7 +37,6 @@ export const CancelButton = Styled(Button)` `; export const LoginButton = Styled(Button)` - padding-left:170px; color: ${palette('primary', 5)}; ${theme('font.subhead4')}; `; @@ -48,7 +49,8 @@ export const LoginModalWrapper = Styled.div` left:0; margin:auto; border-radius: 16px; - background-color: #FFFFFF; + border: solid 1px ${palette('grayscale', 4)}; + background-color: ${palette('grayscale', 0)}; width: 500px; height: 312px; `; diff --git a/src/components/molecules/Notice/index.tsx b/src/components/molecules/Notice/index.tsx deleted file mode 100644 index 26b403f3..00000000 --- a/src/components/molecules/Notice/index.tsx +++ /dev/null @@ -1,54 +0,0 @@ -import { ThumbnailCommentIcon } from 'assets/images'; -import dayjs from 'dayjs'; -import React from 'react'; -import { Content, Info, NoticeWrapper, ThumbnailContainer, ThumbnailInfo, ThumbnailOverlay } from './style'; - -interface IProps { - imgThumbnail: string; - authorNickname: string; - interestList: string[]; - createdAt: string; - title: string; - text: string; - commentNum: number; - onClickFunc: () => void; -} - -function Notice({ - imgThumbnail, - authorNickname, - interestList, - createdAt, - title, - text, - commentNum, - onClickFunc, -}: IProps): React.ReactElement { - const interestDivide = interestList?.join(' | '); - return ( - <> - - -

{authorNickname}

-

{interestDivide}

-

{`${dayjs(createdAt).format('YY.MM.DD')}`}

-
- -

{title}

-

- - - - - - -

{commentNum}

- - - -
- - ); -} - -export default Notice; diff --git a/src/components/molecules/Notice/style.ts b/src/components/molecules/Notice/style.ts deleted file mode 100644 index f97fc815..00000000 --- a/src/components/molecules/Notice/style.ts +++ /dev/null @@ -1,99 +0,0 @@ -import Styled from 'styled-components'; -import { palette, theme } from 'styled-tools'; - -export const Info = Styled.div` - display: flex; - flex-direction: column; - width: 111px; - height: 84px; - color: #404040; - ${theme('font.body1')}; - & p:nth-of-type(1) { - margin: 0 38px 12px 0; - width: 100px; - ${theme('font.subhead3')}; - } - :hover{ - cursor:pointer; - } -`; - -export const Content = Styled.div` - display: flex; - flex-direction: column; - width: 524px; - height: 84px; - color: ${palette('grayscale', 9)}; - ${theme('font.subhead3')}; - & p:nth-of-type(2) { - display: -webkit-box; - margin-top: 12px; - width: 524px; - height: 2.79em; - overflow: hidden; - text-align: left; - text-overflow: ellipsis; - white-space:normal; - word-wrap: break-word; - color: ${palette('grayscale', 7)}; - ${theme('font.body2')}; - -webkit-line-clamp: 3; - -webkit-box-orient: vertical; - } - :hover{ - cursor:pointer; - } -`; - -export const ThumbnailContainer = Styled.div` - position: relative; - img { - width: 170px; - height: 84px; - object-fit: cover; - } - :hover{ - cursor:pointer; - } -`; - -export const ThumbnailOverlay = Styled.div` - position: absolute; - bottom: 0; - transition: .5s ease; - opacity:0; - background: rgb(0, 0, 0); - width: 100%; - height: 100%; - :hover { - opacity:0.6; - } -`; - -export const ThumbnailInfo = Styled.div` - display: flex; - position:absolute; - top: 50%; - left: 50%; - align-items:center; - transform: translate(-50%, -50%); - color: ${palette('grayscale', 0)}; - ${theme('font.body2_eng')}; - img { - margin-right:5px; - width: 20px; - height: 20px; - } - p { - margin-right:10px; - } -`; - -export const NoticeWrapper = Styled.div` - display: flex; - flex-direction: row; - align-items: center; - justify-content: space-around; - border-bottom: 1px solid #DFDFDF; - height: 144px; -`; diff --git a/src/components/molecules/NoticeSingleComment/index.tsx b/src/components/molecules/NoticeSingleComment/index.tsx index 2239fcf8..991b3247 100644 --- a/src/components/molecules/NoticeSingleComment/index.tsx +++ b/src/components/molecules/NoticeSingleComment/index.tsx @@ -2,7 +2,7 @@ import { postNoticeComment } from 'apis'; import { LoginModal, ReplyComment } from 'components/molecules'; import React, { useState } from 'react'; import { useRecoilValue } from 'recoil'; -import { userState, userStatusState } from 'stores/user'; +import { userStatusState } from 'stores/user'; import { IReply } from 'types/challenge.type'; import { CommentContainer, @@ -26,8 +26,8 @@ interface IProps { }; text?: string; }[]; - isDeleted?: boolean; - _id: string; + isDeleted: boolean; + parentCommentID: string; userID: { img: string; _id: string; @@ -35,14 +35,23 @@ interface IProps { }; text: string; noticeID?: string; + isRerender: boolean; + setIsRerender: (value: boolean) => void; } -function NoticeSingleComment({ _id, userID, childrenComment, text, noticeID }: IProps): React.ReactElement { +function NoticeSingleComment({ + parentCommentID, + userID, + childrenComment, + text, + noticeID, + isRerender, + setIsRerender, + isDeleted, +}: IProps): React.ReactElement { const [isOpenReply, setIsOpenReply] = useState(false); const [replyValue, setReplyValue] = useState(''); - const [replyList, setReplyList] = useState(childrenComment); const userStatusData = useRecoilValue(userStatusState); - const userData = useRecoilValue(userState); const [isLoginModalOpen, setIsLoginModalOpen] = useState(false); const onClickReplyOpen = () => { @@ -51,26 +60,12 @@ function NoticeSingleComment({ _id, userID, childrenComment, text, noticeID }: I const handleChange = (event: React.ChangeEvent) => { setReplyValue(event.currentTarget.value); }; - const onSubmit = async (event: React.FormEvent) => { + const handleSubmit = async (event: React.MouseEvent) => { event.preventDefault(); - const variables = { - parentID: _id, - text: replyValue, - }; if (userStatusData) { - await postNoticeComment(userStatusData.token, noticeID, variables); - userData && - setReplyList( - replyList.concat({ - text: variables.text, - userID: { - img: userData.img, - _id: userData._id, - nickname: userData.nickname, - }, - }), - ); + await postNoticeComment(userStatusData.token, noticeID, { parentID: parentCommentID, text: replyValue }); setReplyValue(''); + setIsRerender(!isRerender); } else { setIsLoginModalOpen(true); } @@ -81,7 +76,7 @@ function NoticeSingleComment({ _id, userID, childrenComment, text, noticeID }: I {userID?.nickname} - {text} + {isDeleted ? '삭제된 댓글입니다.' : text} {isOpenReply ? '접기' : '답글보기'} @@ -89,18 +84,18 @@ function NoticeSingleComment({ _id, userID, childrenComment, text, noticeID }: I <> - {replyList.map((data: IReply, index) => ( + {childrenComment.map((data: IReply, index) => ( ))} diff --git a/src/components/molecules/ProfileEdit/index.tsx b/src/components/molecules/ProfileEdit/index.tsx new file mode 100644 index 00000000..9a37a9b1 --- /dev/null +++ b/src/components/molecules/ProfileEdit/index.tsx @@ -0,0 +1,30 @@ +import { EditWhiteIcon } from 'assets/images'; +import React from 'react'; +import { ISettingUserInfo } from 'types/setting.type'; +import * as S from './style'; + +interface IProps { + userInfo: ISettingUserInfo; + imgInput: React.RefObject; + handleInputImg: (e: React.ChangeEvent) => void; +} + +function ProfileEdit({ userInfo, imgInput, handleInputImg }: IProps): React.ReactElement { + return ( + + + + + + ); +} + +export default ProfileEdit; diff --git a/src/components/molecules/ProfileEdit/style.ts b/src/components/molecules/ProfileEdit/style.ts new file mode 100644 index 00000000..5b6217d5 --- /dev/null +++ b/src/components/molecules/ProfileEdit/style.ts @@ -0,0 +1,32 @@ +import { Input } from 'components/atoms'; +import Styled from 'styled-components'; + +export const ProfileContainer = Styled.div` + margin-bottom: 90px; +`; + +interface IProfileImg { + url: string; +} +export const ProfileImg = Styled.div` + width: 150px; + height: 150px; + border-radius: 75px; + background: url(${(props) => props.url}) center center / cover; +`; + +export const EditButton = Styled.img` + cursor: pointer; + + position: relative; + top: -54px; + left: 105px; + + width: 45px; + height: 45px; +`; + +export const ProfileInput = Styled(Input)` + width: 0; + height: 0; +`; diff --git a/src/components/molecules/RegisterCard/index.tsx b/src/components/molecules/RegisterCard/index.tsx new file mode 100644 index 00000000..f2199cbc --- /dev/null +++ b/src/components/molecules/RegisterCard/index.tsx @@ -0,0 +1,99 @@ +import { MinusIcon, PlusIcon } from 'assets/images'; +import { LoginModal } from 'components/molecules'; +import React, { useState } from 'react'; +import { useRecoilValue } from 'recoil'; +import { userStatusState } from 'stores/user'; +import { IAdminChallengePeriod } from 'types/admin.type'; +import { BoxWrapper, CardDetailWrapper, CardSettingWrapper, ChallengeSetting, RegisterButton } from './style'; + +interface IProps { + setIsOpenModal: (value: boolean) => void; + dateToString: (date: string) => void; + periodData: IAdminChallengePeriod; + registerCount: number; + setRegisterCount: (value: number) => void; +} + +function RegisterCard({ + setIsOpenModal, + dateToString, + periodData, + registerCount, + setRegisterCount, +}: IProps): React.ReactElement { + const [isLoginModalOpen, setIsLoginModalOpen] = useState(false); + const userStatusData = useRecoilValue(userStatusState); + const [userStateNum, setUserState] = useState(userStatusData ? userStatusData.userType : 0); + + function minusCount() { + if (registerCount > 0) { + setRegisterCount(registerCount - 1); + } + } + + function registerAuthority() { + if (userStateNum === 0) { + return setIsLoginModalOpen(true); + } else { + setIsOpenModal(true); + } + } + + const getRestDay = (dateString: string): number => { + const date = new Date( + parseInt(dateString.substr(0, 4)), + parseInt(dateString.substr(5, 2)) - 1, + parseInt(dateString.substr(8, 2)), + ); + const today = new Date(); + const rest = Math.ceil((date.getTime() - today.getTime()) / (1000 * 3600 * 24)); + return rest; + }; + return ( + <> + +

신청기간

+

{getRestDay(periodData.registerEndDT)}일 남음

+

챌린지 기간

+

+ {dateToString(periodData.challengeStartDT)} ~ {dateToString(periodData.challengeEndDT)} +

+ + +

챌린지 개수 설정

+

2개 이상부터 뱃지 획득 가능

+
+ +

{ + minusCount(); + }} + > + +

+ {registerCount} +

{ + setRegisterCount(registerCount + 1); + }} + > + +

+
+
+ + + + +
+ + ); +} + +export default RegisterCard; diff --git a/src/components/molecules/RegisterCard/style.ts b/src/components/molecules/RegisterCard/style.ts new file mode 100644 index 00000000..cb443056 --- /dev/null +++ b/src/components/molecules/RegisterCard/style.ts @@ -0,0 +1,104 @@ +import Styled from 'styled-components'; +import { palette, theme } from 'styled-tools'; + +export const CardDetailWrapper = Styled.div` + margin-bottom:30px; + border-radius: 10px; + box-shadow: 0 0 24px 0 rgba(13, 12, 63, 0.1); + padding: 50px 30px; + width: 354px; + height: 487px; + + h1{ + margin: 0 243px 4px 0; + width: 51px; + height: 21px; + text-align: center; + color: ${palette('grayscale', 7)}; + ${theme('font.body2')}; + } + h2{ + margin: 4px 0 0; + width: 294px; + height: 44px; + text-align: left; + color: ${palette('grayscale', 7)}; + ${theme('font.dp1')}; + } + h3{ + margin-top:40px; + width: 62px; + height: 21px; + color: ${palette('grayscale', 7)}; + ${theme('font.body2')}; + } + h4{ + margin: 4px 0 0; + width: 294px; + height: 44px; + text-align: left; + color: ${palette('grayscale', 7)}; + ${theme('font.dp1')}; + } +`; + +export const CardSettingWrapper = Styled.div` + display: flex; + flexDirection: row; + justifyContent: space-between; + + h1{ + margin: 0 37px 0 0; + margin-top:60px; + width: 89px; + height: 21px; + text-align: center; + color: ${palette('grayscale', 7)}; + ${theme('font.body2')}; + } + p{ + width: 126px; + height: 18px; + color: ${palette('grayscale', 2)}; + ${theme('font.body1')}; + } +`; + +export const BoxWrapper = Styled.div` + box-sizing: border-box; + display: flex; + align-items: center; + justify-content: space-between; + margin-top: 60px; + border: solid 1px ${palette('grayscale', 1)}; + border-radius: 4px; + padding: 0 16px; + width: 119px; + height: 36px; + margin-left : 49px; + ${theme('font.subhead3_eng')}; + + p{ + border:none; + background-color: ${palette('grayscale', 0)}; + cursor: pointer; + } +`; + +export const ChallengeSetting = Styled.div` + display:inline-block; +`; + +export const RegisterButton = Styled.div` + margin-top:50px; + + button{ + border:none; + border-radius: 4px; + background: linear-gradient(91.91deg, ${palette('primary', 3)} 7.34%, ${palette('primary', 0)} 90.35%); + width:294px; + height:60px; + color: ${palette('grayscale', 0)}; + ${theme('font.subhead3')}; + } +`; diff --git a/src/components/molecules/RegisterCompletedModal/index.tsx b/src/components/molecules/RegisterCompletedModal/index.tsx new file mode 100644 index 00000000..254e917c --- /dev/null +++ b/src/components/molecules/RegisterCompletedModal/index.tsx @@ -0,0 +1,27 @@ +import { CheckCircleIcon } from 'assets/images'; +import { Modal } from 'components/atoms'; +import React from 'react'; +import { useRecoilState } from 'recoil'; +import { userState } from 'stores/user'; +import { RegisterSubmitWrapper } from './style'; + +interface IProps { + isRegisterSubmit: boolean; + setIsRegisterSubmit: (value: boolean) => void; +} + +function RegisterCompletedModal({ isRegisterSubmit, setIsRegisterSubmit }: IProps): React.ReactElement { + const [userData, setUserData] = useRecoilState(userState); + return ( + + + +
신청완료!
+

{userData?.nickname}님 챌린지가 정상적으로

+

신청되었습니다.

+
+
+ ); +} + +export default RegisterCompletedModal; diff --git a/src/components/molecules/RegisterCompletedModal/style.ts b/src/components/molecules/RegisterCompletedModal/style.ts new file mode 100644 index 00000000..790310f0 --- /dev/null +++ b/src/components/molecules/RegisterCompletedModal/style.ts @@ -0,0 +1,38 @@ +import Styled from 'styled-components'; +import { palette, theme } from 'styled-tools'; + +export const RegisterSubmitWrapper = Styled.div` + position: fixed; + top:0; + right:0; + bottom:0; + left:0; + margin:auto; + border-width: 1px; + border-style: solid; + border-radius: 16px; + border-color:${palette('primary', 3)}; + background-color: ${palette('grayscale', 0)}; + width: 500px; + height: 273px; + + img{ + display:flex; + margin:auto; + margin-top:-40px; + } + h5{ + background: linear-gradient(to right, ${palette('primary', 3)}, ${palette('primary', 0)}); + -webkit-background-clip: text; + background-clip: text; + padding-top:20px; + padding-bottom:40px; + text-align: center; + -webkit-text-fill-color: transparent; + ${theme('font.dp4')}; + } + p{ + text-align: center; + ${theme('font.body3')}; + } +`; diff --git a/src/components/molecules/RegisterConfirmModal/index.tsx b/src/components/molecules/RegisterConfirmModal/index.tsx new file mode 100644 index 00000000..e049e871 --- /dev/null +++ b/src/components/molecules/RegisterConfirmModal/index.tsx @@ -0,0 +1,73 @@ +import { CautionIcon, CheckIcon, XIcon } from 'assets/images'; +import { Modal } from 'components/atoms'; +import React from 'react'; +import { useRecoilState } from 'recoil'; +import { userState } from 'stores/user'; +import { IAdminChallengePeriod } from 'types/admin.type'; +import { + CautionWrapper, + ConfirmDetail, + ConfirmModalWrapper, + DetailContent, + ImgIcon, + ModalButton, + XButton, +} from './style'; + +interface IProps { + isOpenModal: boolean; + setIsOpenModal: (value: boolean) => void; + dateToString: (date: string) => void; + periodData: IAdminChallengePeriod; + registerCount: number; + handleSubmit: () => void; +} + +function RegisterConfirmModal({ + isOpenModal, + setIsOpenModal, + dateToString, + periodData, + registerCount, + handleSubmit, +}: IProps): React.ReactElement { + const [userData, setUserData] = useRecoilState(userState); + return ( + + + { + setIsOpenModal(false); + }} + > + + + +

잠깐! 확인하고 신청 완료하세요

+

아래 정보를 확인해주세요

+ +

챌린지 기간

+

+ {dateToString(periodData.challengeStartDT)}~{dateToString(periodData.challengeEndDT)} +

+

신청자

+

{userData?.nickname}님

+

챌린지 개수

+

{registerCount}개

+
+ + +

주의사항

+
+
챌린지 개수 2개를 선택하시면 최종 달성률 80%를 넘더라도 배지를 받을 수 없어요!
+
+ + +

주의 사항을 확인했으며 챌린지 신청을 완료합니다.

+
+
+
+ ); +} + +export default RegisterConfirmModal; diff --git a/src/components/molecules/RegisterConfirmModal/style.ts b/src/components/molecules/RegisterConfirmModal/style.ts new file mode 100644 index 00000000..01c4d0c5 --- /dev/null +++ b/src/components/molecules/RegisterConfirmModal/style.ts @@ -0,0 +1,117 @@ +import { Button, Img } from 'components/atoms'; +import Styled from 'styled-components'; +import { palette, theme } from 'styled-tools'; + +export const XButton = Styled(Button)` + width:24px; + height:24px; + float:right; + margin-right:30px; + margin-top:30px; + cursor: pointer; +`; + +export const ImgIcon = Styled(Img)` + width:24px; + height:24px; + float:right; + cursor: pointer; +`; + +export const ConfirmModalWrapper = Styled.div` + position: fixed; + top:0; + right:0; + bottom:0; + left:0; + margin:auto; + border-radius: 16px; + background-color: ${palette('grayscale', 0)}; + width: 500px; + height: 613px; +`; + +export const ConfirmDetail = Styled.div` + padding: 80px 80px 80px; + + h1{ + ${theme('font.h1')}; + color: ${palette('grayscale', 7)}; + } + h2{ + padding-top:10px; + padding-bottom:30px; + color: ${palette('grayscale', 4)}; + ${theme('font.body3')}; + } + img{ + margin-right: 8px; + } + h4{ + text-align: center; + color: ${palette('grayscale', 7)}; + ${theme('font.body2')}; + } + h5{ + padding-top:12px; + text-align: center; + color: ${palette('primary', 6)}; + ${theme('font.body2')}; + } +`; + +export const DetailContent = Styled.div` + border-radius: 30px; + padding: 20px 40px 40px 40px; + height:192px; + text-align:left; + background-color: #f9f9f9; + + h3{ + display:inline-block; + padding-top:20px; + width: calc(100% - 150px); + text-align:left; + color: ${palette('grayscale', 7)}; + ${theme('font.body2')}; + } + p{ + display:inline-block; + text-align:left; + color: ${palette('grayscale', 7)}; + ${theme('font.subhead3')}; + } + `; + +export const CautionWrapper = Styled.div` + display: flex; + align-items: center; + justify-content: center; + margin-top: 50px; +`; + +export const ModalButton = Styled.button` + display: flex; + flex-direction: row; + align-items: center; + justify-content: center; + border:none; + border-radius: 0px 0px 16px 16px; + background: linear-gradient(91.91deg, ${palette('primary', 3)} 7.34%, ${palette('primary', 0)} 90.35%); + width:500px; + height:64px; + + img{ + display:inline-block; + margin-right: 10px; + } + p{ + display:inline-block; + border:none; + border-radius: 0px 0px 16px 16px; + background: linear-gradient(91.91deg, ${palette('primary', 3)} 7.34%, ${palette('primary', 0)} 90.35%); + color: ${palette('grayscale', 0)}; + ${theme('font.subhead3')}; + } + +`; diff --git a/src/components/molecules/RemovableTag/index.tsx b/src/components/molecules/RemovableTag/index.tsx new file mode 100644 index 00000000..a68c4e25 --- /dev/null +++ b/src/components/molecules/RemovableTag/index.tsx @@ -0,0 +1,23 @@ +import { XIcon } from 'assets/images'; +import React from 'react'; +import * as S from './style'; + +interface IProps { + setList: (e: string) => void; + text: string; +} + +function RemovableTag({ setList, text }: IProps): React.ReactElement { + const handleOnClick = (e: React.MouseEvent) => { + setList(e.currentTarget.id); + }; + + return ( + +
{text}
+ +
+ ); +} + +export default RemovableTag; diff --git a/src/components/molecules/RemovableTag/style.ts b/src/components/molecules/RemovableTag/style.ts new file mode 100644 index 00000000..c1cff06e --- /dev/null +++ b/src/components/molecules/RemovableTag/style.ts @@ -0,0 +1,22 @@ +import Styled from 'styled-components'; +import { palette, theme } from 'styled-tools'; + +export const RemovableContainer = Styled.div` + ${theme('font.subhead3')}; + margin-right: 10px; + padding: 12px 30px; + border-radius: 60px; + border: solid 1px ${palette('primary', 5)}; + display: flex; + flex-direction: row; + align-items: center; + color: ${palette('primary', 5)}; + + div { + margin-right: 10px; + } + + img { + width: 14px; + } +`; diff --git a/src/components/molecules/ReplyComment/index.tsx b/src/components/molecules/ReplyComment/index.tsx index e248ee08..1b210206 100644 --- a/src/components/molecules/ReplyComment/index.tsx +++ b/src/components/molecules/ReplyComment/index.tsx @@ -6,14 +6,15 @@ interface IProps { text?: string; className?: string; img?: string; + isDeleted?: boolean; } -function ReplyComment({ nickname, text, img }: IProps): React.ReactElement { +function ReplyComment({ nickname, text, img, isDeleted }: IProps): React.ReactElement { return ( - + {nickname} - {text} + {isDeleted ? '삭제된 댓글입니다.' : text} ); } diff --git a/src/components/molecules/SingleComment/index.tsx b/src/components/molecules/SingleComment/index.tsx index de342eed..16f96107 100644 --- a/src/components/molecules/SingleComment/index.tsx +++ b/src/components/molecules/SingleComment/index.tsx @@ -2,7 +2,7 @@ import { postConcertComment } from 'apis'; import { LoginModal, ReplyComment } from 'components/molecules'; import React, { useState } from 'react'; import { useRecoilValue } from 'recoil'; -import { userState, userStatusState } from 'stores/user'; +import { userStatusState } from 'stores/user'; import { IReply } from 'types/challenge.type'; import { CommentContainer, @@ -26,8 +26,8 @@ interface IProps { }; text?: string; }[]; - isDeleted?: boolean; - _id: string; + isDeleted: boolean; + parentCommentID: string; userID: { img: string; _id: string; @@ -35,14 +35,23 @@ interface IProps { }; text: string; concertID?: string; + isRerender: boolean; + setIsRerender: (value: boolean) => void; } -function SingleComment({ _id, userID, childrenComment, text, concertID }: IProps): React.ReactElement { +function SingleComment({ + parentCommentID, + userID, + childrenComment, + text, + concertID, + isRerender, + setIsRerender, + isDeleted, +}: IProps): React.ReactElement { const [isOpenReply, setIsOpenReply] = useState(false); const [replyValue, setReplyValue] = useState(''); - const [replyList, setReplyList] = useState(childrenComment); const userStatusData = useRecoilValue(userStatusState); - const userData = useRecoilValue(userState); const [isLoginModalOpen, setIsLoginModalOpen] = useState(false); const onClickReplyOpen = () => { @@ -51,26 +60,12 @@ function SingleComment({ _id, userID, childrenComment, text, concertID }: IProps const handleChange = (event: React.ChangeEvent) => { setReplyValue(event.currentTarget.value); }; - const onSubmit = async (event: React.FormEvent) => { + const handleSubmit = async (event: React.MouseEvent) => { event.preventDefault(); - const variables = { - parentID: _id, - text: replyValue, - }; if (userStatusData) { - await postConcertComment(userStatusData.token, concertID, variables); - userData && - setReplyList( - replyList.concat({ - text: variables.text, - userID: { - img: userData.img, - _id: userData._id, - nickname: userData.nickname, - }, - }), - ); + await postConcertComment(userStatusData.token, concertID, { parentID: parentCommentID, text: replyValue }); setReplyValue(''); + setIsRerender(!isRerender); } else { setIsLoginModalOpen(true); } @@ -79,9 +74,9 @@ function SingleComment({ _id, userID, childrenComment, text, concertID }: IProps return ( - + {userID?.nickname} - {text} + {isDeleted ? '삭제된 댓글입니다.' : text} {isOpenReply ? '접기' : '답글보기'} @@ -89,18 +84,18 @@ function SingleComment({ _id, userID, childrenComment, text, concertID }: IProps <> - {replyList.map((data: IReply, index) => ( + {childrenComment.map((data: IReply, index) => ( ))} diff --git a/src/components/molecules/SpeakerExpCard/index.tsx b/src/components/molecules/SpeakerExpCard/index.tsx new file mode 100644 index 00000000..1895fdcd --- /dev/null +++ b/src/components/molecules/SpeakerExpCard/index.tsx @@ -0,0 +1,22 @@ +import React from 'react'; +import { Exp, Image, SSpeakerExpCard } from './style'; + +export interface IProps { + exp1: string; + exp2: string; + img: string; +} + +function SpeakerExpCard({ exp1, exp2, img }: IProps): React.ReactElement { + return ( + + + + {exp1}
+ {exp2} +
+
+ ); +} + +export default SpeakerExpCard; diff --git a/src/components/molecules/SpeakerExpCard/style.ts b/src/components/molecules/SpeakerExpCard/style.ts new file mode 100644 index 00000000..b3acca20 --- /dev/null +++ b/src/components/molecules/SpeakerExpCard/style.ts @@ -0,0 +1,20 @@ +import Styled from 'styled-components'; +import { palette, theme } from 'styled-tools'; + +export const Image = Styled.img` + width: 260px; + height: 260px; +`; + +export const Exp = Styled.p` + ${theme('font.body4')}; + color : ${palette('grayscale', 0)}; + text-align: center; + margin-top : 48px; +`; + +export const SSpeakerExpCard = Styled.div` + display : flex; + flex-direction : column; + align-items : center; +`; diff --git a/src/components/molecules/ToggleSwitch/index.tsx b/src/components/molecules/ToggleSwitch/index.tsx new file mode 100644 index 00000000..47e71b3d --- /dev/null +++ b/src/components/molecules/ToggleSwitch/index.tsx @@ -0,0 +1,20 @@ +import React from 'react'; +import * as S from './style'; + +interface IProps { + checked: boolean; + onChange: (e: React.ChangeEvent) => void; +} + +function ToggleSwitch({ checked, onChange }: IProps): React.ReactElement { + return ( + + + + + + + ); +} + +export default ToggleSwitch; diff --git a/src/components/molecules/ToggleSwitch/style.ts b/src/components/molecules/ToggleSwitch/style.ts new file mode 100644 index 00000000..6fb56cd3 --- /dev/null +++ b/src/components/molecules/ToggleSwitch/style.ts @@ -0,0 +1,36 @@ +import { CheckBox, Label } from 'components/atoms'; +import Styled from 'styled-components'; +import { ifProp, palette } from 'styled-tools'; + +export const ToggleSwitchContainer = Styled.div<{ checked: boolean }>` + width: 48px; + height: 26px; + background-color: ${ifProp('checked', palette('grayscale', 7), palette('grayscale', 1))}; + transition: background-color 0.1s linear; + position: relative; + border-radius: 50px; +`; + +export const SwitchCheckbox = Styled(CheckBox)` + display: none; + + &:checked + label div { + transform: translateX(22px); + } +`; + +export const SwitchLabel = Styled(Label)` + cursor: pointer; + background-color: ${palette('grayscale', 1)}; +`; + +export const Ball = Styled.div` + position: absolute; + height: 20px; + width: 20px; + border-radius: 50%; + top: 3px; + left: 3px; + transition: transform 0.1s linear; + background-color: ${palette('grayscale', 0)}; +`; diff --git a/src/components/molecules/index.ts b/src/components/molecules/index.ts index 5f449f32..f21cb3b5 100644 --- a/src/components/molecules/index.ts +++ b/src/components/molecules/index.ts @@ -1,18 +1,22 @@ export { default as AdminChallengeCard } from './AdminChallengeCard'; export { default as AdminChallengeOpenForm } from './AdminChallengeOpenForm'; -export { default as AdminWriteForm } from './AdminWriteForm'; export { default as BadgeCard } from './BadgeCard'; export { default as CategoryButton } from './CategoryButton'; export { default as ChallengeCard } from './ChallengeCard'; +export { default as ChallengeCardBottom } from './ChallengeCardBottom'; +export { default as ChallengeCardFold } from './ChallengeCardFold'; +export { default as ChallengeCardList } from './ChallengeCardList'; +export { default as ChallengeCardProfile } from './ChallengeCardProfile'; export { default as ChallengeComment } from './ChallengeComment'; export { default as ChallengeCommentWrite, default as ChallengeReCommentWrite } from './ChallengeCommentWrite'; -export { default as ChallengeDetailCard } from './ChallengeDetailCard'; -export { default as ChallengeDetailRegister } from './ChallengeDetailRegister'; -export { default as ChallengeEditCard } from './ChallengeEditCard'; +export { default as ChallengeEditForm } from './ChallengeEditForm'; export { default as ChallengeHeader } from './ChallengeHeader'; export { default as ChallengeModalComment } from './ChallengeModalComment'; +export { default as ChallengeProgressBar } from './ChallengeProgressBar'; export { default as ChallengeSingleComment } from './ChallengeSingleComment'; -export { default as ChallengeWriteCard } from './ChallengeWriteCard'; +export { default as ChallengeWriteButton } from './ChallengeWriteButton'; +export { default as ChallengeWriteCard, default as ChallengeWriteForm } from './ChallengeWriteForm'; +export { default as ChallengeWriteInterest } from './ChallengeWriteInterest'; export { default as ChallengeWriteTag } from './ChallengeWriteTag'; export { default as CommentedBoardRow } from './CommentedBoardRow'; export { default as CommentWrite } from './CommentWrite'; @@ -25,17 +29,21 @@ export { default as DropDown } from './DropDown'; export { default as DropDownMulti } from './DropDownMulti'; export { default as EditorForm } from './EditorForm'; export { default as FindPwdForm } from './FindPwdForm'; +export { default as FormInput } from './FormInput'; export { default as HamDropDown } from './HamDropDown'; -export { default as JoinCheck } from './JoinCheck'; -export { default as JoinForm } from './JoinForm'; -export { default as LoginForm } from './LoginForm'; export { default as LoginModal } from './LoginModal'; export { default as MyPageConcertCard } from './MyPageConcertCard'; export { default as MyPageSection } from './MyPageSection'; export { default as MyPageSlider } from './MyPageSlider'; -export { default as Notice } from './Notice'; export { default as NoticeSingleComment } from './NoticeSingleComment'; +export { default as ProfileEdit } from './ProfileEdit'; +export { default as RegisterCard } from './RegisterCard'; +export { default as RegisterCompletedModal } from './RegisterCompletedModal'; +export { default as RegisterConfirmModal } from './RegisterConfirmModal'; export { default as RegisterHeader } from './RegisterHeader'; +export { default as RemovableTag } from './RemovableTag'; export { default as ChallengeReCommentList, default as ReplyComment } from './ReplyComment'; export { default as SearchBar } from './SearchBar'; export { default as SingleComment } from './SingleComment'; +export { default as SpeakerExpCard } from './SpeakerExpCard'; +export { default as ToggleSwitch } from './ToggleSwitch'; diff --git a/src/components/organisms/AdminChallengeList/index.tsx b/src/components/organisms/AdminChallengeList/index.tsx deleted file mode 100644 index c05a8265..00000000 --- a/src/components/organisms/AdminChallengeList/index.tsx +++ /dev/null @@ -1,50 +0,0 @@ -import { getChallengeList } from 'apis'; -import { GreydfPlusIcon as PlusIcon } from 'assets/images'; -import { AdminChallengeCard } from 'components/molecules'; -import React, { useEffect, useState } from 'react'; -import { Link } from 'react-router-dom'; -import { useRecoilValue } from 'recoil'; -import { userStatusState } from 'stores/user'; -import { IAdminChallenge } from 'types/admin.type'; -import { AddCard, AddExp, AddImage, ListContainer, PageLabel, Title, Wrapper } from './style'; - -function AdminChallengeList(): React.ReactElement { - const userStatusData = useRecoilValue(userStatusState); - const [challengeDataList, setChallengeDataList] = useState(null); - - useEffect(() => { - if (userStatusData) getChallengeDataList(userStatusData.token, 30, 0); - else alert('로그인 후 이용하세요'); - }, [userStatusData]); - - const getChallengeDataList = async (token: string, limit: number, offset: number): Promise => { - const data = await getChallengeList(token, limit, offset); - data && setChallengeDataList(data); - }; - - return ( - - 관리자 페이지 - 챌린지 정보 - - - - - 챌린지 등록하기 - - - {challengeDataList?.map((data, id) => { - return ( - data && ( - - - - ) - ); - })} - - - ); -} - -export default AdminChallengeList; diff --git a/src/components/organisms/AdminChallengeOpen/index.tsx b/src/components/organisms/AdminChallengeOpen/index.tsx deleted file mode 100644 index bd70abe7..00000000 --- a/src/components/organisms/AdminChallengeOpen/index.tsx +++ /dev/null @@ -1,121 +0,0 @@ -import { challengeOpen } from 'apis'; -import { CheckOffIcon, CheckOnIcon, GreyPlusIcon } from 'assets/images'; -import { FileUpload as PhotoUpload } from 'components/atoms'; -import { AdminChallengeOpenForm } from 'components/molecules'; -import React, { useEffect, useState } from 'react'; -import { useHistory } from 'react-router-dom'; -import { useRecoilValue } from 'recoil'; -import { userStatusState } from 'stores/user'; -import { - CheckContainer, - CheckExp, - CheckImage, - ElementLabel, - OpenButton, - PageLabel, - PhotoUploadBottomDesc, - PhotoUploadContainer, - PhotoUploadImage, - PhotoUploadMiddleDesc, - SCheckBox, - Title, - UploadContainer, - Wrapper, -} from './style'; - -function AdminChallengeOpen(): React.ReactElement { - const history = useHistory(); - const userStatusData = useRecoilValue(userStatusState); - const [image, setImage] = useState(null); - const [isChecked, setIsChecked] = useState(false); - const [isButtonDisabled, setIsButtonDisabled] = useState(true); - const [isConditionMet, setIsConditionMet] = useState({ - title: false, - challengePeriod: { - start: false, - end: false, - }, - applyPeriod: { - start: false, - end: false, - }, - peopleNum: false, - }); - const [challengeOpenData, setChallengeOpenData] = useState({ - title: '', - challengePeriod: { - start: '', - end: '', - }, - applyPeriod: { - start: '', - end: '', - }, - peopleNum: 0, - }); - const checkHandler = () => { - setIsChecked(!isChecked); - }; - useEffect(() => { - if ( - isConditionMet.title && - isConditionMet.challengePeriod.start && - isConditionMet.challengePeriod.end && - isConditionMet.applyPeriod.start && - isConditionMet.applyPeriod.end && - isConditionMet.peopleNum && - image != null && - isChecked - ) { - setIsButtonDisabled(false); - } else { - setIsButtonDisabled(true); - } - }, [isConditionMet, image, isChecked]); - const btnHandler = async () => { - if (userStatusData) { - const isSuccess = await challengeOpen(userStatusData.token, { ...challengeOpenData, img: image }); - isSuccess && history.goBack(); - } else { - alert('로그인 후 이용하세요'); - } - }; - - return ( - - 관리자 페이지 - 챌린지 등록 - - - 사진 업로드 - - - - - 대표이미지 -
- (필수) -
- (1920px X 253px) -
-
-
- - - - 위 내용을 확인하셨습니까? - - - - 등록하기 - -
- ); -} - -export default AdminChallengeOpen; diff --git a/src/components/organisms/AdminWrite/index.tsx b/src/components/organisms/AdminWrite/index.tsx deleted file mode 100644 index 35f3b43c..00000000 --- a/src/components/organisms/AdminWrite/index.tsx +++ /dev/null @@ -1,131 +0,0 @@ -import { postConcertWrite, postNoticeWrite } from 'apis'; -import { AdminWriteForm } from 'components/molecules'; -import React, { useEffect, useState } from 'react'; -import { useHistory } from 'react-router-dom'; -import { useRecoilValue } from 'recoil'; -import { userStatusState } from 'stores/user'; -import { PageLabel, Title, Wrapper, WriteButton } from './style'; - -interface IProps { - menu: string; -} -function AdminWrite({ menu }: IProps): React.ReactElement { - const history = useHistory(); - const userStatusData = useRecoilValue(userStatusState); - const [isButtonDisabled, setIsButtonDisabled] = useState(true); - const [isConditionMet, setIsConditionMet] = useState({ - title: false, - category: false, - menu: false, - content: false, - hashtag: false, - video: false, - thumbnail: false, - nickname: false, - }); - const [writeData, setWriteData] = useState<{ - title: string; - category: string[]; - menu: string; - content: string; - hashtag: string[]; - video: File | null; - thumbnail: File | null; - nickname: string; - }>({ - title: '', - category: [''], - menu: '', - content: '', - hashtag: [''], - video: null, - thumbnail: null, - nickname: '', - }); - const handleBtnOnClick = () => { - if (writeData.menu === '공지사항') { - postNoticeHandler(); - } else { - postConcertHandler(); - } - }; - const postConcertHandler = async () => { - if (userStatusData) { - const isSuccess = await postConcertWrite(userStatusData.token, { - videoLink: writeData.video, - imgThumbnail: writeData.thumbnail, - title: writeData.title, - text: writeData.content, - interest: writeData.category, - hashtag: writeData.hashtag, - authorNickname: writeData.nickname, - }); - isSuccess && history.goBack(); - } else { - alert('로그인 후 이용하세요'); - } - }; - const postNoticeHandler = async () => { - if (userStatusData) { - const isSuccess = await postNoticeWrite(userStatusData.token, { - title: writeData.title, - text: writeData.content, - interest: writeData.category, - hashtag: writeData.hashtag, - }); - isSuccess && history.goBack(); - } else { - alert('로그인 후 이용하세요'); - } - }; - - useEffect(() => { - if (writeData.menu === 'Share Together') { - if ( - isConditionMet.title && - isConditionMet.category && - isConditionMet.menu && - isConditionMet.content && - isConditionMet.hashtag && - isConditionMet.video && - isConditionMet.thumbnail && - isConditionMet.nickname - ) { - setIsButtonDisabled(false); - } else { - setIsButtonDisabled(true); - } - } else { - if ( - isConditionMet.title && - isConditionMet.category && - isConditionMet.menu && - isConditionMet.content && - isConditionMet.hashtag - ) { - setIsButtonDisabled(false); - } else { - setIsButtonDisabled(true); - } - } - }, [isConditionMet, writeData.menu]); - - return ( - - 관리자 페이지 - 글 올리기 - - - 등록하기 - - - ); -} - -export default AdminWrite; diff --git a/src/components/organisms/AdminWrite/style.ts b/src/components/organisms/AdminWrite/style.ts deleted file mode 100644 index 8466c53b..00000000 --- a/src/components/organisms/AdminWrite/style.ts +++ /dev/null @@ -1,37 +0,0 @@ -import { Button, Label } from 'components/atoms'; -import Styled from 'styled-components'; -import { theme } from 'styled-tools'; - -export const PageLabel = Styled(Label)` - margin-top : 60px; - line-height: 1.5; - letter-spacing: -0.5px; - color : #3d3d3d; - font-size: 16px; -`; - -export const Title = Styled(Label)` - ${theme('font.dp4')} - margin-top:10px; - margin-bottom : 110px; - color:#3d3d3d; -`; - -export const WriteButton = Styled(Button)<{ isButtonDisabled?: boolean }>` -/* 버튼 색이 안바뀜 */ - ${theme('font.subhead3')} - width: 406px; - height: 60px; - border-radius: 4px; - color : #ffffff; - background-color : ${(props) => (props.isButtonDisabled ? '#dfdfdf' : undefined)}; - background-image : ${(props) => - !props.isButtonDisabled ? 'linear-gradient(to right, #36c8f5,#13e2dd )' : undefined}; - margin-bottom : 304px; -`; - -export const Wrapper = Styled.div` - display : flex; - flex-direction: column; - align-items: center; -`; diff --git a/src/components/molecules/AdminWriteForm/index.tsx b/src/components/organisms/AdminWriteForm/index.tsx similarity index 72% rename from src/components/molecules/AdminWriteForm/index.tsx rename to src/components/organisms/AdminWriteForm/index.tsx index 85b7d57a..c71306b4 100644 --- a/src/components/molecules/AdminWriteForm/index.tsx +++ b/src/components/organisms/AdminWriteForm/index.tsx @@ -7,10 +7,6 @@ import { IAdminWriteConditionMet } from 'types/admin.type'; import { IUserData } from 'types/user.type'; import { CategoryChipsContainer, - HashTag, - HashTagContainer, - HashTagInput, - HashTagInputContainer, Icon, NicknameContainer, RowContainer, @@ -43,21 +39,8 @@ function AdminWriteForm({ const [category, setCategory] = useState('카테고리를 선택하세요'); const [menu, setMenu] = useState(''); const [content, setContent] = useState(''); - const [currentHashtag, setCurrentHashtag] = useState(''); const [videoFile, setVideoFile] = useState(null); const [thumbnail, setThumbnail] = useState(null); - const [isHashTagFocused, setIsHashTagFocused] = useState(false); - - const addHashTag = () => { - if (currentHashtag !== '' && writeData.hashtag.length < 15) { - if (writeData.hashtag[0] == '') { - setWriteData({ ...writeData, hashtag: [currentHashtag] }); - } else { - setWriteData({ ...writeData, hashtag: [...writeData.hashtag, currentHashtag] }); - } - setCurrentHashtag(''); - } - }; useEffect(() => { if (menuProps === 'sharetogether') setMenu('Share Together'); @@ -153,25 +136,25 @@ function AdminWriteForm({ - 제목 + 제목 { - if (typeof value === 'string') setWriteData({ ...writeData, title: value }); + setWriteData({ ...writeData, title: value }); }} isConditionMet={isConditionMet.title} /> - 연사 닉네임 + 연사 닉네임 { - if (typeof value === 'string') setWriteData({ ...writeData, nickname: value }); + setWriteData({ ...writeData, nickname: value }); }} isConditionMet={isConditionMet.nickname} /> @@ -179,7 +162,7 @@ function AdminWriteForm({
- 메뉴 + 메뉴
- 카테고리 + 카테고리 - 동영상 업로드 + 동영상 업로드 - + - 동영상 업로드하기 + 동영상 업로드하기 - 썸네일 업로드 + 썸네일 업로드 - 썸네일 이미지 업로드하기 + 썸네일 이미지 업로드하기 - 해시태그 - - { - setCurrentHashtag(e.target.value); - }} - onFocus={() => { - setIsHashTagFocused(true); - }} - onBlur={() => { - setIsHashTagFocused(false); - }} - onKeyUp={(e) => { - if (e.keyCode === 13) { - addHashTag(); - } - }} - /> - - - {writeData.hashtag.length >= 0 && - writeData.hashtag.map((hashtag, id) => { - return ( - hashtag != '' && ( - - #{hashtag} - - ) - ); - })} - ); } diff --git a/src/components/molecules/AdminWriteForm/style.ts b/src/components/organisms/AdminWriteForm/style.ts similarity index 62% rename from src/components/molecules/AdminWriteForm/style.ts rename to src/components/organisms/AdminWriteForm/style.ts index b40e85ad..a1987c63 100644 --- a/src/components/molecules/AdminWriteForm/style.ts +++ b/src/components/organisms/AdminWriteForm/style.ts @@ -1,8 +1,10 @@ import { Input, Label } from 'components/atoms'; -import Styled from 'styled-components'; +import Styled, { css } from 'styled-components'; +import { palette, theme } from 'styled-tools'; export const UploadDescription = Styled.div` - color : #a5a5a5; + ${theme('font.subhead3')}; + color : ${palette('grayscale', 3)}; text-align: center; margin-top :4px; margin-bottom : 20px; @@ -62,46 +64,13 @@ export const TopRowContainer = Styled.div` display : flex; justify-content : space-between; `; -export const HashTagInput = Styled(Input)` - width : 100%; - height : 100%; - border-radius:4px; - padding : 18px 20px; -`; -export const HashTagInputContainer = Styled.div<{ isFocused: boolean }>` - border : ${(props) => (props.isFocused ? 'double 1px transparent' : '1px solid #c1c1c1')}; - background-image : ${(props) => - props.isFocused ? 'linear-gradient(white, white), linear-gradient(to right, #36c8f5,#13e2dd)' : undefined}; - background-origin : ${(props) => (props.isFocused ? 'border-box' : undefined)}; - background-clip : ${(props) => (props.isFocused ? 'content-box, border-box' : undefined)}; - width : 100%; - height : 60px; - border-radius: 4px; -`; -export const HashTagContainer = Styled.div` - width : 100%; - display : flex; - column-gap: 10px; - flex-direction: row; - flex-wrap : wrap; - margin-top : 20px; - margin-bottom : 130px; -`; + export const WriteLabel = Styled(Label)` + ${theme('font.subhead4')}; width : 100%; - color: #0d0d0d; + color: ${palette('grayscale', 9)}; margin-bottom : 8px; `; -export const HashTag = Styled.div` - padding : 5px 10px; - background-color: #f5f5f5; - color : #a5a5a5; - min-height : 31px; - max-width : 100%; - white-space : break-all; - border-radius: 50px; - margin-bottom:10px; -`; export const CategoryChipsContainer = Styled.div` width : 412px; diff --git a/src/components/organisms/CategoryList/index.tsx b/src/components/organisms/CategoryList/index.tsx index ef184b26..0d1054d9 100644 --- a/src/components/organisms/CategoryList/index.tsx +++ b/src/components/organisms/CategoryList/index.tsx @@ -1,8 +1,18 @@ -import { MoreClickedIcon, MoreIcon, NextIcon } from 'assets/images'; +import { MoreClickedIcon, MoreIcon, NextIcon, PrevIcon } from 'assets/images'; import { CategoryButton } from 'components/molecules'; import React, { useEffect, useRef, useState } from 'react'; import { interestList } from 'resources/string'; -import { CategoryListWrapper, Hashtag, HashtagContainer, Main, More, NextButton, Shadow } from './style'; +import { + CategoryListWrapper, + GradientLeft, + Hashtag, + HashtagContainer, + Main, + More, + NextButton, + PrevButton, + Shadow, +} from './style'; interface IProps { reRenderCategory?: (interest: string) => void; @@ -12,6 +22,8 @@ interface IProps { function CategoryList({ reRenderCategory, selectedCategory, categoryChange }: IProps): React.ReactElement { const totalSlide = 6; const [currentSlide, setCurrentSlide] = useState(0); + const [animation, setAnimation] = useState(false); + const [localVisible, setLocalVisible] = useState(!currentSlide); const slideRef = useRef(null); const [isOpenMore, setIsOpenMore] = useState(false); const [isMoreClicked, setIsMoreClicked] = useState(false); @@ -24,8 +36,14 @@ function CategoryList({ reRenderCategory, selectedCategory, categoryChange }: IP reRenderCategory && reRenderCategory(category); categoryChange && categoryChange(); }; - - const nextSlide = () => { + const handlePrev = () => { + if (currentSlide === 0) { + setCurrentSlide(totalSlide); + } else { + setCurrentSlide(currentSlide - 1); + } + }; + const handleNext = () => { if (currentSlide >= totalSlide) { setCurrentSlide(0); } else { @@ -38,18 +56,29 @@ function CategoryList({ reRenderCategory, selectedCategory, categoryChange }: IP slideRef.current.style.transform = `translateX(-${currentSlide * 15}%)`; } }, [currentSlide]); + useEffect(() => { + if ((localVisible && currentSlide) || (localVisible && !currentSlide)) { + setAnimation(true); + setTimeout(() => setAnimation(false), 500); + } + setLocalVisible(!currentSlide); + }, [localVisible, currentSlide]); return (
- - + {(!localVisible || animation) && ( + + )} + {(!localVisible || animation) && } + + {interestList.map((tag, index) => ( - +
diff --git a/src/components/organisms/CategoryList/style.ts b/src/components/organisms/CategoryList/style.ts index b367b775..5422241a 100644 --- a/src/components/organisms/CategoryList/style.ts +++ b/src/components/organisms/CategoryList/style.ts @@ -1,14 +1,18 @@ -import Styled from 'styled-components'; +import { fadeIn, fadeOut } from 'assets/styles/animation'; +import Styled, { css } from 'styled-components'; export const Main = Styled.div` display: flex; align-items: center; width: 815px; + position: relative; `; -export const HashtagContainer = Styled.div` +export const HashtagContainer = Styled.div<{ disappear: boolean }>` display: flex; - width: 645px; + align-items: center; + width: ${({ disappear }) => (disappear ? '645px' : '726px')}; + margin-left: ${({ disappear }) => (disappear ? '65px' : '0')}; overflow: hidden; `; @@ -16,6 +20,34 @@ export const Hashtag = Styled.div` display: flex; `; +export const GradientLeft = Styled.div<{ disappear: boolean }>` + position: absolute; + margin-left: 45px; + background-image: linear-gradient(to right, #FFFFFF 33.87%, rgba(255, 255, 255, 0) 94.35%); + width: 81px; + height: 46px; + animation-name: ${fadeOut}; + animation-fill-mode: forwards; + ${(props) => + props.disappear && + css` + animation-name: ${fadeIn}; + `} + z-index: 4; +`; + +export const PrevButton = Styled.img<{ disappear: boolean }>` + position: absolute; + animation-name: ${fadeOut}; + animation-fill-mode: forwards; + ${(props) => + props.disappear && + css` + animation-name: ${fadeIn}; + `} + z-index: 5; +`; + export const Shadow = Styled.div` position: absolute; right: 120px; diff --git a/src/components/organisms/ChallengeDetailCard/index.tsx b/src/components/organisms/ChallengeDetailCard/index.tsx new file mode 100644 index 00000000..e5c64eea --- /dev/null +++ b/src/components/organisms/ChallengeDetailCard/index.tsx @@ -0,0 +1,114 @@ +import { DeleteChallenge } from 'apis'; +import { + ChallengeCardBottom, + ChallengeCardFold, + ChallengeCardList, + ChallengeCardProfile, + DeleteModal, + LoginModal, +} from 'components/molecules'; +import React, { useEffect, useState } from 'react'; +import { useRecoilValue } from 'recoil'; +import { userState, userStatusState } from 'stores/user'; +import { Container, MainCardWrapper } from './style'; + +interface IProps { + nickname?: string; + image?: string; + createdAt?: string; + interest?: string[]; + good?: string; + bad?: string; + learn?: string; + like: number; + comments: number; + isLike?: boolean; + isScrap?: boolean; + id: string; + onChange?: () => void; + handleFetch?: (offset: number) => void; +} + +function ChallengeDetailCard({ + nickname, + image, + createdAt, + interest, + good, + bad, + learn, + like, + isLike, + isScrap, + comments, + id, + onChange, + handleFetch, +}: IProps): React.ReactElement { + const userStatusData = useRecoilValue(userStatusState); + const userData = useRecoilValue(userState); + const [isClosed, setIsClosed] = useState(false); + const [userStateNickname, setUserStateNickname] = useState(userData ? userData.nickname : 0); + const [isMine, setIsMine] = useState(false); + const [isDeleteModalOpen, setIsDeleteModalOpen] = useState(false); + const [isLoginModalOpen, setIsLoginModalOpen] = useState(false); + const [isRerender, setIsRerender] = useState(false); + + useEffect(() => { + setIsMine(nickname === userStateNickname); + document.body.style.overflow = isDeleteModalOpen || isLoginModalOpen === true ? 'hidden' : 'unset'; + }, [isDeleteModalOpen, isLoginModalOpen, nickname, userStateNickname]); + + const deleteClickHandler = async () => { + if (userStatusData) { + const token = userStatusData?.token; + const data = await DeleteChallenge(id, token); + data && setIsDeleteModalOpen(false); + onChange?.(); + handleFetch?.(0); + } else { + alert('네트워크가 좋지 않습니다'); + } + }; + + return ( + <> + + + + + { + + } + + + + + + + ); +} + +export default ChallengeDetailCard; diff --git a/src/components/organisms/ChallengeDetailCard/style.ts b/src/components/organisms/ChallengeDetailCard/style.ts new file mode 100644 index 00000000..2c4bf33c --- /dev/null +++ b/src/components/organisms/ChallengeDetailCard/style.ts @@ -0,0 +1,17 @@ +import Styled from 'styled-components'; +import { palette } from 'styled-tools'; + +export const MainCardWrapper = Styled.div` + position: relative; + align-items: center; + margin: 0 auto; + border-radius: 18px; + box-shadow: 0px 0px 24px rgba(13, 12, 63, 0.1); + background: ${palette('grayscale', 0)}; + padding-top: 40px; + width : 844px; +`; + +export const Container = Styled.div` + padding-top: 60px; +`; diff --git a/src/components/organisms/ChallengeEditCard/index.tsx b/src/components/organisms/ChallengeEditCard/index.tsx new file mode 100644 index 00000000..b837d20b --- /dev/null +++ b/src/components/organisms/ChallengeEditCard/index.tsx @@ -0,0 +1,157 @@ +import { ChallengeEdit, getChallengeContent } from 'apis'; +import { ChallengeEditForm, ChallengeProgressBar, ChallengeWriteInterest } from 'components/molecules'; +import React, { useEffect, useState } from 'react'; +import { useHistory } from 'react-router-dom'; +import { useRecoilValue } from 'recoil'; +import { userStatusState } from 'stores/user'; +import { BlackButton, ButtonWrapper, ColorButton, Header } from './style'; + +export interface IProps { + description?: string; + className?: string; + value?: string; +} + +interface IEditCard { + id: string; +} + +function EditCard({ id }: IEditCard): React.ReactElement { + const userStatusData = useRecoilValue(userStatusState); + const history = useHistory(); + const maxByte = 1000; //최대 1000바이트 + const [countProgressBar, setCountProgressBar] = useState(0); //프로그래스바 + + const [byte, setByte] = useState({ + byte1: 0, + byte2: 0, + byte3: 0, + }); + + const [textForm, setTextForm] = useState({ + description1: '', + description2: '', + description3: '', + }); + + const { description1, description2, description3 } = textForm; + const textOnChange = (target: any) => { + const { name, value } = target; + setTextForm({ + ...textForm, + [name]: value, + }); + }; + + const handleSubmit = async (e: React.MouseEvent) => { + e.preventDefault(); + setTextForm({ + description1: '', + description2: '', + description3: '', + }); + const editData = { + good: description1, + bad: description2, + learn: description3, + interest: selectedInterest, + }; + if (userStatusData) { + const data = await ChallengeEdit(editData, userStatusData.token, id); + data && history.goBack(); + } + }; + + const progressBarState = () => { + let count = 0; + if (byte.byte1 > 0) { + count++; + } + if (byte.byte2 > 0) { + count++; + } + if (byte.byte3 > 0) { + count++; + } + setCountProgressBar(count); + }; + + const handleTotalOnChange = (e: React.ChangeEvent) => { + const text_val = e.target.value; //입력한 문자 + const target_byte_name = 'byte' + e.target.name.split('description')[1]; + let str = ''; + let totalByte = stringtoByte(text_val); + + if (totalByte >= maxByte) { + str = text_val.substring(0, maxByte); + e.target.value = str; + totalByte = maxByte; + } + textOnChange(e.target); + setByte({ + ...byte, + [target_byte_name]: totalByte, + }); + }; + const stringtoByte = (value: string) => { + return value.length; + }; + + useEffect(() => { + progressBarState(); + }, [byte]); + useEffect(() => { + getDefaultData(); + }, []); + + const getDefaultData = async () => { + if (userStatusData) { + const data = await getChallengeContent(id, userStatusData.token); + if (data) { + setTextForm({ description1: data.good, description2: data.bad, description3: data.learn }); + setSelectedInterest(data.interest); + setByte({ + byte1: stringtoByte(data.good), + byte2: stringtoByte(data.bad), + byte3: stringtoByte(data.learn), + }); + } + } else { + } + }; + + const [selectedInterest, setSelectedInterest] = useState([]); + + const indextoName = (index: undefined | number) => { + switch (index) { + case 1: + return '1st'; + case 2: + return `2nd`; + case 3: + return `3rd`; + default: + return `${index}th`; + } + }; + + return ( + <> +
Learn Myself {indextoName(userStatusData?.progressGeneration)}
+ + + + {countProgressBar === 3 ? ( + + 수정완료 + + ) : ( + + 수정완료 + + )} + + ); +} + +export default EditCard; diff --git a/src/components/molecules/ChallengeWriteCard/style.ts b/src/components/organisms/ChallengeEditCard/style.ts similarity index 59% rename from src/components/molecules/ChallengeWriteCard/style.ts rename to src/components/organisms/ChallengeEditCard/style.ts index 4eb0f48f..23c1a8fd 100644 --- a/src/components/molecules/ChallengeWriteCard/style.ts +++ b/src/components/organisms/ChallengeEditCard/style.ts @@ -18,35 +18,6 @@ export const InterestTagButton = Styled(Button)` ${theme('font.subhead3')}; `; -export const CharacterWrapper = Styled.div` - position:sticky; - top:20px; - margin: 0 auto; - background-color: ${palette('grayscale', 0)}; - padding-top:60px; - width:844px; - - img{ - padding-top:29px; - } - p{ - padding-top:12.32px; - padding-bottom: 12px; - ${theme('font.subhead2')}; - color : ${palette('grayscale', 5)}; - } - h1{ - padding-top:29px; - padding-left:200px; - } - h2{ - padding-left:450px; - } - h3{ - text-align:end; - } -`; - export const QuestionWrapper = Styled.div` margin: 0 auto; padding-top:60px; @@ -103,62 +74,6 @@ export const TagListWrapper = Styled.div` } `; -export const ProgressBarStep0 = Styled.span` - display: inline-block; - background-color: #d6d3d3; - width: 844px; - height: 5px; - - span{ - display: inline-block; - background-color: ${palette('primary', 3)}; - width: 1%; - height: 5px; - } -`; - -export const ProgressBarStep1 = Styled.span` - display: inline-block; - background-color: #d6d3d3; - width: 844px; - height: 5px; - - span{ - display: inline-block; - background-color: ${palette('primary', 3)}; - width: 34%; - height: 5px; - } -`; - -export const ProgressBarStep2 = Styled.span` - display: inline-block; - background-color: #d6d3d3; - width: 844px; - height: 5px; - - span{ - display: inline-block; - background-color: ${palette('primary', 3)}; - width: 67%; - height: 5px; - } -`; - -export const ProgressBarStep3 = Styled.span` - display: inline-block; - background-color: #d6d3d3; - width: 844px; - height: 5px; - - span{ - display: inline-block; - background-color: ${palette('primary', 3)}; - width: 100%; - height: 5px; - } -`; - export const ButtonWrapper = Styled.div` align-items: center; margin: 0 auto; @@ -166,6 +81,7 @@ export const ButtonWrapper = Styled.div` `; export const ColorButton = Styled(Button)` + margin: 0 auto; margin-top:60px; border:none; @@ -190,7 +106,3 @@ export const BlackButton = Styled(Button)` background: ${palette('grayscale', 1)}; ${theme('font.subhead3')}; `; - -export const CharacterStepImg = Styled.img` - padding-left:55px; -`; diff --git a/src/components/organisms/ChallengeOpenPhotoUpload/index.tsx b/src/components/organisms/ChallengeOpenPhotoUpload/index.tsx new file mode 100644 index 00000000..8b34f313 --- /dev/null +++ b/src/components/organisms/ChallengeOpenPhotoUpload/index.tsx @@ -0,0 +1,24 @@ +import { GreyPlusIcon } from 'assets/images'; +import { FileUpload as PhotoUpload } from 'components/atoms'; +import React from 'react'; +import { PhotoUploadBottomDesc, PhotoUploadContainer, PhotoUploadImage, PhotoUploadMiddleDesc } from './style'; +interface IProps { + setImage: (image: File | null) => void; +} +function ChallengeOpenPhotoUpload({ setImage }: IProps): React.ReactElement { + return ( + + + + + 대표이미지 +
+ (필수) +
+ (1920px X 253px) +
+
+ ); +} + +export default ChallengeOpenPhotoUpload; diff --git a/src/components/organisms/ChallengeOpenPhotoUpload/style.ts b/src/components/organisms/ChallengeOpenPhotoUpload/style.ts new file mode 100644 index 00000000..29a017d7 --- /dev/null +++ b/src/components/organisms/ChallengeOpenPhotoUpload/style.ts @@ -0,0 +1,30 @@ +import Styled from 'styled-components'; +import { palette, theme } from 'styled-tools'; + +export const PhotoUploadBottomDesc = Styled.div` + ${theme('font.body2_eng')} + color : ${palette('grayscale', 3)}; +`; + +export const PhotoUploadMiddleDesc = Styled.div` + ${theme('font.subhead3')} + color : ${palette('grayscale', 3)}; + text-align: center; + margin-top :4px; + margin-bottom : 20px; +`; + +export const PhotoUploadImage = Styled.img` + width : 38px; + height : 38px; +`; + +export const PhotoUploadContainer = Styled.div` + width: 262px; + height: 216px; + background-color : #f2f2f2; + display : flex; + flex-direction : column; + align-items : center; + justify-content : center; +`; diff --git a/src/components/organisms/ChallengeWriteCard/index.tsx b/src/components/organisms/ChallengeWriteCard/index.tsx new file mode 100644 index 00000000..abe0d176 --- /dev/null +++ b/src/components/organisms/ChallengeWriteCard/index.tsx @@ -0,0 +1,137 @@ +import { writeForm } from 'apis'; +import { + ChallengeProgressBar, + ChallengeWriteButton, + ChallengeWriteForm, + ChallengeWriteInterest, +} from 'components/molecules'; +import React, { useCallback, useEffect, useState } from 'react'; +import { useHistory } from 'react-router-dom'; +import { useRecoilValue } from 'recoil'; +import { userStatusState } from 'stores/user'; +import { Header } from './style'; + +interface IProps { + onChangeForm: (form: { description1: string; description2: string; description3: string }) => void; +} + +function WriteCard({ onChangeForm }: IProps): React.ReactElement { + const history = useHistory(); + const userStatusData = useRecoilValue(userStatusState); + const [countProgressBar, setCountProgressBar] = useState(0); //프로그래스바 + const maxByte = 1000; //최대 1000바이트 + + const [byte, setByte] = useState({ + byte1: 0, + byte2: 0, + byte3: 0, + }); + + const [textForm, setTextForm] = useState({ + description1: '', + description2: '', + description3: '', + }); + + const { description1, description2, description3 } = textForm; + + const textOnChange = (target: any) => { + const { name, value } = target; + setTextForm({ + ...textForm, + [name]: value, + }); + }; + + const handleSubmit = async (e: React.MouseEvent) => { + setUserData({ ...userData, interest: selectedInterest }); + e.preventDefault(); + onChangeForm(textForm); + setTextForm({ + description1: '', + description2: '', + description3: '', + }); + const writeData = { + good: description1, + bad: description2, + learn: description3, + interest: selectedInterest, + }; + if (userStatusData) { + await writeForm(writeData, userStatusData.token); + history.goBack(); + } + }; + + const progressBarState = useCallback(() => { + let count = 0; + if (byte.byte1 > 0) { + count++; + } + if (byte.byte2 > 0) { + count++; + } + if (byte.byte3 > 0) { + count++; + } + setCountProgressBar(count); + }, [byte.byte1, byte.byte2, byte.byte3]); + + const totalOnChange = (e: React.ChangeEvent) => { + const text_val = e.target.value; //입력한 문자 + const target_byte_name = 'byte' + e.target.name.split('description')[1]; + let str = ''; + let totalByte = 0; + for (let i = 0; i < text_val.length; i++) { + totalByte += 1; + } + + if (totalByte >= maxByte) { + str = text_val.substring(0, maxByte); + e.target.value = str; + totalByte = maxByte; + } + + textOnChange(e.target); + setByte({ + ...byte, + [target_byte_name]: totalByte, + }); + }; + + useEffect(() => { + progressBarState(); + }, [byte, progressBarState]); + + const [userData, setUserData] = useState({ + interest: [''], + }); + + const [selectedInterest, setSelectedInterest] = useState([]); + + const indextoName = (index: undefined | number) => { + switch (index) { + case 1: + return '1st'; + case 2: + return `2nd`; + case 3: + return `3rd`; + default: + return `${index}th`; + } + }; + + return ( + <> +
Learn Myself {indextoName(userStatusData?.progressGeneration)}
+ + + + + + ); +} + +export default WriteCard; diff --git a/src/components/organisms/ChallengeWriteCard/style.ts b/src/components/organisms/ChallengeWriteCard/style.ts new file mode 100644 index 00000000..53c5e782 --- /dev/null +++ b/src/components/organisms/ChallengeWriteCard/style.ts @@ -0,0 +1,8 @@ +import Styled from 'styled-components'; +import { theme } from 'styled-tools'; + +export const Header = Styled.div` + padding-top:100px; + text-align:center; + ${theme('font.dp3_eng')}; +`; diff --git a/src/components/organisms/CommentList/index.tsx b/src/components/organisms/CommentList/index.tsx index 26600e91..d27a0c84 100644 --- a/src/components/organisms/CommentList/index.tsx +++ b/src/components/organisms/CommentList/index.tsx @@ -3,16 +3,17 @@ import { CommentWrite, LoginModal, SingleComment } from 'components/molecules'; import React, { useState } from 'react'; import { useRecoilValue } from 'recoil'; import { userStatusState } from 'stores/user'; -import { IConcertComment, IConcertNewComment } from 'types/concert.type'; +import { IConcertComment } from 'types/concert.type'; import { CommentWriteContainer } from './style'; interface IProps { commentList: Array; concertID?: string; - reLoadComment: (newComment: IConcertNewComment) => void; + isRerender: boolean; + setIsRerender: (value: boolean) => void; } -function CommentList({ commentList, concertID, reLoadComment }: IProps): React.ReactElement { +function CommentList({ commentList, concertID, isRerender, setIsRerender }: IProps): React.ReactElement { const [commentValue, setCommentValue] = useState(''); const [isLoginModalOpen, setIsLoginModalOpen] = useState(false); const userStatusData = useRecoilValue(userStatusState); @@ -20,39 +21,38 @@ function CommentList({ commentList, concertID, reLoadComment }: IProps): React.R const handleChange = (event: React.ChangeEvent) => { setCommentValue(event.currentTarget.value); }; - const onSubmit = async (event: React.FormEvent) => { + const handleSubmit = async (event: React.MouseEvent) => { event.preventDefault(); - const variables = { - text: commentValue, - }; if (userStatusData) { - await postConcertComment(userStatusData.token, concertID, variables); - reLoadComment(variables); + await postConcertComment(userStatusData.token, concertID, { parentID: null, text: commentValue }); setCommentValue(''); + setIsRerender(!isRerender); } else { setIsLoginModalOpen(true); } }; + return ( <> {commentList?.map((data: IConcertComment, index) => ( ))} diff --git a/src/components/organisms/ConcertList/index.tsx b/src/components/organisms/ConcertList/index.tsx index 9982339c..5971683e 100644 --- a/src/components/organisms/ConcertList/index.tsx +++ b/src/components/organisms/ConcertList/index.tsx @@ -60,7 +60,7 @@ function ConcertList({ concertData, totalConcertNum, currentPage, setCurrentPage title={card.title} text={card.text} commentNum={card.commentNum} - likes={card.likes} + likeNum={card.likes} key={card._id} onClickFunc={() => history.push(`/concert/${card._id}`)} > diff --git a/src/components/organisms/Hamburger/index.tsx b/src/components/organisms/Hamburger/index.tsx index ddf26891..d42856e9 100644 --- a/src/components/organisms/Hamburger/index.tsx +++ b/src/components/organisms/Hamburger/index.tsx @@ -6,12 +6,11 @@ import React, { useEffect, useState } from 'react'; import { Link, useHistory } from 'react-router-dom'; import { useRecoilState } from 'recoil'; import { userState, userStatusState } from 'stores/user'; -import Styled from 'styled-components'; import { - HamburgerContainer, BottomContainer, ChallengeEndUser, EngTitleBtn, + HamburgerContainer, Hide, Line, LoginButton, @@ -65,7 +64,7 @@ function Hamburger(): React.ReactElement { arr.push({ name: changeIndextoName(i), link: `/challenge/${i}` }); } if (generationNum.registGeneration) { - arr.push({ name: changeIndextoName(generationNum.registGeneration), link: '/challengeRegister' }); + arr.push({ name: changeIndextoName(generationNum.registGeneration), link: '/challenge/register' }); } } setChallengeList(arr); diff --git a/src/components/organisms/Hamburger/style.ts b/src/components/organisms/Hamburger/style.ts index c094d354..47f39415 100644 --- a/src/components/organisms/Hamburger/style.ts +++ b/src/components/organisms/Hamburger/style.ts @@ -1,6 +1,6 @@ import { Button } from 'components/atoms'; import Styled from 'styled-components'; -import { theme } from 'styled-tools'; +import { palette, theme } from 'styled-tools'; export const HamburgerContainer = Styled.div` display : flex; @@ -9,7 +9,7 @@ export const HamburgerContainer = Styled.div` flex-direction:column; z-index : 999; box-shadow: 0 4px 40px 0 rgba(30, 37, 98, 0.1); - background-color : #ffffff; + background-color : ${palette('grayscale', 0)}; width: 282px; height : 100vh; animation : slideIn 0.5s; @@ -29,7 +29,7 @@ export const HamburgerContainer = Styled.div` export const LogOutBtn = Styled.div` ${theme('font.body2')} font-size: 16px; - color: #8b8b8b; + color: ${palette('grayscale', 4)}; margin-left: 8px; margin-right: 24px; `; @@ -37,7 +37,7 @@ export const LogOutBtn = Styled.div` export const SettingBtn = Styled.div` ${theme('font.body2')} font-size: 16px; - color: #3d3d3d; + color: ${palette('grayscale', 7)}; `; export const BottomContainer = Styled.div` @@ -66,11 +66,11 @@ export const MiddleContainer = Styled.div` ::-webkit-scrollbar-thumb { box-sizing: border-box; border-radius: 0.5rem; - background: #c1c1c1; + background: ${palette('grayscale', 2)}; } /* Handle on hover */ ::-webkit-scrollbar-thumb:hover { - background: #c1c1c1; + background: ${palette('grayscale', 2)}; } `; @@ -93,12 +93,12 @@ export const UserNameLabel = Styled.div` ${theme('font.body2')}; font-size : 16px; margin-top : 28px; - color : #3d3d3d; + color : ${palette('grayscale', 7)}; `; export const UserIcon = Styled.img` margin : 120px 91px 0 91px; - border : 1px solid #dfdfdf; + border : 1px solid ${palette('grayscale', 1)}; border-radius:50px; width : 100px; height : 100px; @@ -112,7 +112,7 @@ export const NoLoginSubTitle = Styled.div` margin-bottom : 30px; -webkit-background-clip: text; background-clip: text; - background-image:linear-gradient(to right, #34caf4, #13e2dd); + background-image:linear-gradient(to right, #34caf4, ${palette('primary', 0)}); text-align : center; -webkit-text-fill-color: transparent; `; @@ -129,7 +129,7 @@ export const UnChallengeUserSubTitle = Styled(Button)<{ color?: string }>` `; export const ChallengeEndUser = Styled(Button)` - color: #03b6ce; + color: ${palette('primary', 5)}; ${theme('font.subhead3_eng')}; margin-top : 30px; `; @@ -150,13 +150,13 @@ export const LoginButton = Styled(Button)` export const LoginExp = Styled.div` ${theme('font.subhead3')}; height: 18px; - color : #3d3d3d; + color : ${palette('grayscale', 7)}; `; export const TitleBtn = Styled(Button)` margin : 10px 0; height : 20px; - color : #3d3d3d; + color : ${palette('grayscale', 7)}; font-family : AppleSDGothicNeo; font-size : 16px; :hover { @@ -167,7 +167,7 @@ export const TitleBtn = Styled(Button)` export const EngTitleBtn = Styled(Button)` margin : 10px 0; height : 20px; - color : #3d3d3d; + color : ${palette('grayscale', 7)}; font-size : 16px; font-family : HomepageBaukasten; :hover { @@ -177,7 +177,7 @@ export const EngTitleBtn = Styled(Button)` export const Line = Styled.div` margin : 20px 0; - background-color: #c1c1c1; + background-color: ${palette('grayscale', 2)}; width :164px; height: 1px; `; @@ -190,7 +190,7 @@ export const Padding = Styled.div` export const Hide = Styled.div` position : absolute; top:-50px; - background-image: linear-gradient(to bottom, rgba(255, 255, 255, 0), #ffffff); + background-image: linear-gradient(to bottom, rgba(255, 255, 255, 0), ${palette('grayscale', 0)}); width : 100%; height : 50px; `; diff --git a/src/components/organisms/HashTagAddForm/index.tsx b/src/components/organisms/HashTagAddForm/index.tsx new file mode 100644 index 00000000..a5e5b2e0 --- /dev/null +++ b/src/components/organisms/HashTagAddForm/index.tsx @@ -0,0 +1,56 @@ +import React, { useState } from 'react'; +import { IUserData } from 'types/user.type'; +import { HashTag, HashTagContainer, HashTagInput, HashTagInputContainer, Wrapper } from './style'; + +export interface IProps { + writeData: IUserData; + setWriteData: (value: IUserData) => void; +} + +function HashTagAddForm({ writeData, setWriteData }: IProps): React.ReactElement { + const [currentHashtag, setCurrentHashtag] = useState(''); + const [isHashTagFocused, setIsHashTagFocused] = useState(false); + const addHashTag = () => { + if (currentHashtag !== '' && writeData.hashtag.length < 15) { + if (writeData.hashtag[0] == '') { + setWriteData({ ...writeData, hashtag: [currentHashtag] }); + } else { + setWriteData({ ...writeData, hashtag: [...writeData.hashtag, currentHashtag] }); + } + setCurrentHashtag(''); + } + }; + return ( + + + { + setCurrentHashtag(e.target.value); + }} + onFocus={() => { + setIsHashTagFocused(true); + }} + onBlur={() => { + setIsHashTagFocused(false); + }} + onKeyUp={(e) => { + if (e.keyCode === 13) { + addHashTag(); + } + }} + /> + + + {writeData.hashtag.length >= 0 && + writeData.hashtag.map((hashtag, id) => { + return hashtag != '' && #{hashtag}; + })} + + + ); +} + +export default HashTagAddForm; diff --git a/src/components/organisms/HashTagAddForm/style.ts b/src/components/organisms/HashTagAddForm/style.ts new file mode 100644 index 00000000..d06b3bda --- /dev/null +++ b/src/components/organisms/HashTagAddForm/style.ts @@ -0,0 +1,63 @@ +import { Input } from 'components/atoms'; +import Styled, { css } from 'styled-components'; +import { palette, theme } from 'styled-tools'; + +export const HashTagInput = Styled(Input)` + ${theme('font.body2')}; + width : 100%; + height : 100%; + border-radius:4px; + padding : 18px 20px; +`; + +export const HashTag = Styled.div` + ${theme('font.body2')}; + padding : 5px 10px; + background-color: #f5f5f5; + color : ${palette('grayscale', 3)}; + min-height : 31px; + max-width : 100%; + white-space : break-all; + border-radius: 50px; + margin-bottom:10px; +`; + +export const HashTagInputContainer = Styled.div<{ isFocused: boolean }>` + ${(props) => + props.isFocused + ? css` + border: double 1px transparent; + background-image: linear-gradient(white, white), + linear-gradient(to right, ${palette('primary', 3)}, ${palette('primary', 0)}); + background-origin: border-box; + background-clip: content-box, border-box; + ` + : css` + border: 1px solid ${palette('grayscale', 2)}; + `}; + width : 100%; + height : 60px; + border-radius: 4px; +`; + +export const HashTagContainer = Styled.div` + width : 100%; + display : flex; + column-gap: 10px; + flex-direction: row; + flex-wrap : wrap; + margin-top : 20px; + margin-bottom : 130px; +`; +export const Wrapper = Styled.div` + display : flex; + flex-direction : column; + align-items : center; + width : 844px; + input{ + border : none; + :focus{ + outline : none; + } + } +`; diff --git a/src/components/organisms/Header/style.ts b/src/components/organisms/Header/style.ts index 50545d4c..674e47c3 100644 --- a/src/components/organisms/Header/style.ts +++ b/src/components/organisms/Header/style.ts @@ -1,4 +1,5 @@ import Styled from 'styled-components'; +import { palette } from 'styled-tools'; export const ButtonWrapper = Styled.div` display : flex; @@ -17,7 +18,7 @@ position: fixed; top:0; left:0; z-index:999; -background-color : #242424; +background-color : ${palette('grayscale', 8)}; width : 100vw; height : 60px; `; diff --git a/src/components/organisms/InterestModal/index.tsx b/src/components/organisms/InterestModal/index.tsx new file mode 100644 index 00000000..c64f22e7 --- /dev/null +++ b/src/components/organisms/InterestModal/index.tsx @@ -0,0 +1,65 @@ +import { Modal } from 'components/atoms'; +import React from 'react'; +import { interestList } from 'resources/string'; +import { InterestButton, InterestButtonWrapper, ModalButton, ModalLabel, ModalWrapper } from './style'; + +interface IProps { + isInterestModalOpen: boolean; + setIsInterestModalOpen: (value: boolean) => void; + handleInterestOnClick: (interest: string) => void; + selectedInterest: string[]; + modalBtnHandler: () => void; +} + +function InterestModal({ + isInterestModalOpen, + setIsInterestModalOpen, + handleInterestOnClick, + selectedInterest, + modalBtnHandler, +}: IProps): React.ReactElement { + return ( + + + 관심있는 분야를 5개 선택해 주세요 + + {interestList.map((interest, id) => { + const handleOnClick = () => { + handleInterestOnClick(interest); + }; + return ( + + {interest} + + ); + })} + + 0 ? false : true} + onClick={modalBtnHandler} + > +
확인 ({selectedInterest.length}/5)
+
+
+
+ ); +} + +export default InterestModal; diff --git a/src/components/organisms/InterestModal/style.ts b/src/components/organisms/InterestModal/style.ts new file mode 100644 index 00000000..618cd897 --- /dev/null +++ b/src/components/organisms/InterestModal/style.ts @@ -0,0 +1,101 @@ +import { Button, Label } from 'components/atoms'; +import Styled, { css } from 'styled-components'; +import { palette, theme } from 'styled-tools'; + +export const InterestButtonWrapper = Styled.div` + display : flex; + flex-direction : row; + justify-content : center; + flex-wrap: wrap; +`; + +export const InterestButton = Styled(Button)<{ order: number }>` + ${theme('font.subhead4')} + border: solid 1px ${palette('grayscale', 4)}; + ${(props) => + props.order == 0 + ? css` + background-color: ${palette('primary', 0)}; + border-color: ${palette('primary', 0)}; + ` + : props.order == 1 + ? css` + background-color: ${palette('primary', 3)}; + border-color: ${palette('primary', 3)}; + ` + : props.order == 2 + ? css` + background-color: ${palette('primary', 2)}; + border-color: ${palette('primary', 2)}; + ` + : props.order == 3 + ? css` + background-color: ${palette('primary', 5)}; + border-color: ${palette('primary', 5)}; + ` + : props.order == 4 + ? css` + background-color: ${palette('primary', 4)}; + border-color: ${palette('primary', 4)}; + ` + : css` + background-color: ${palette('grayscale', 0)}; + border-color: ${palette('grayscale', 4)}; + `}}; + padding : 12px 30px; + margin : 12px 5px; + height : 48px; + border-radius: 60px; + ${(props) => + props.order == -1 + ? css` + color: ${palette('grayscale', 4)}; + ` + : css` + color: ${palette('grayscale', 0)}; + `}; + ; +`; + +export const ModalButton = Styled(Button)<{ selectedInterest: string[] }>` + width: 406px; + height: 60px; + padding: 19px 172px 19px 170px; + border-radius: 4px; + background-color : ${palette('grayscale', 1)}; + ${theme('font.subhead3')} + color : ${palette('grayscale', 0)}; + margin-top : 38px; + ${(props) => + props.selectedInterest.length > 0 + ? css` + background-color: ${palette('grayscale', 9)}; + ` + : css` + background-color: ${palette('grayscale', 1)}; + `}; +`; + +export const ModalLabel = Styled(Label)` + ${theme('font.h1')} + color : ${palette('grayscale', 9)}; + margin-bottom : 38px; +`; + +export const ModalWrapper = Styled.div` + position : fixed; + top : 0; + left : 0; + right : 0; + bottom : 0; + margin : auto; + width : 1030px; + height : 614px; + border-radius: 16px; + padding: 40px 100px; + box-shadow: -4px 11px 24px 0 rgba(13, 12, 63, 0.1); + background-color : ${palette('grayscale', 0)}; + display : flex; + flex-direction : column; + align-items : center; +`; diff --git a/src/components/organisms/Join/index.tsx b/src/components/organisms/Join/index.tsx deleted file mode 100644 index d0337c7c..00000000 --- a/src/components/organisms/Join/index.tsx +++ /dev/null @@ -1,151 +0,0 @@ -import { postJoin } from 'apis'; -import { Modal } from 'components/atoms'; -import { JoinForm } from 'components/molecules'; -import React, { useEffect, useState } from 'react'; -import { useHistory } from 'react-router-dom'; -import { interestList } from 'resources/string'; -import { - InterestButton, - InterestButtonWrapper, - JoinButton, - JoinLabel, - JoinWrap, - ModalButton, - ModalLabel, - ModalWrapper, -} from './style'; - -function CJoin(): React.ReactElement { - const history = useHistory(); - const [isButtonDisabled, setIsButtonDisabled] = useState(true); - const [isInterestModalOpen, setIsInterestModalOpen] = useState(false); - const [isConditionMet, setIsConditionMet] = useState({ - email: false, - password: false, - passwordCheck: false, - nickname: false, - interest: false, - policyMust: false, - gender: false, - }); - const [userData, setUserData] = useState({ - email: '', - password: '', - passwordCheck: '', - nickname: '', - gender: -1, - interest: [''], - marpolicy: false, - policyMust: false, - }); - const [selectedInterest, setSelectedInterest] = useState([]); - const handleInterestOnClick = (interest: string) => { - if (selectedInterest.length === 0) { - setSelectedInterest([interest]); - } - if (selectedInterest.length < 5) { - if (!selectedInterest.includes(interest)) { - setSelectedInterest([...selectedInterest, interest]); - } else { - setSelectedInterest(selectedInterest.filter((v) => v !== interest)); - } - } else { - if (selectedInterest.includes(interest)) { - setSelectedInterest(selectedInterest.filter((v) => v !== interest)); - } - } - }; - const modalBtnHandler = async () => { - //여기서 api호출!! - const postData = { - email: userData.email, - password: userData.password, - nickname: userData.nickname, - interest: userData.interest, - gender: userData.gender, - marpolicy: userData.marpolicy, - }; - const getData = await postJoin(postData); - if (getData) { - history.push('/'); - } - }; - const joinBtnHandler = () => { - setIsInterestModalOpen(true); - }; - useEffect(() => { - setUserData({ ...userData, interest: selectedInterest }); - }, [selectedInterest]); - - useEffect(() => { - if ( - isConditionMet.email && - isConditionMet.password && - isConditionMet.passwordCheck && - isConditionMet.nickname && - isConditionMet.gender && - isConditionMet.policyMust - ) { - setIsButtonDisabled(false); - } else { - setIsButtonDisabled(true); - } - }, [isConditionMet]); - - return ( - - 회원가입 - - - 가입 완료 - - - - 관심있는 분야를 5개 선택해 주세요 - - {interestList.map((interest, id) => { - const handleOnClick = () => { - handleInterestOnClick(interest); - }; - return ( - - {interest} - - ); - })} - - 0 ? false : true} - onClick={modalBtnHandler} - > -
확인 ({selectedInterest.length}/5)
-
-
-
-
- ); -} - -export default CJoin; diff --git a/src/components/organisms/Join/style.ts b/src/components/organisms/Join/style.ts deleted file mode 100644 index 84930981..00000000 --- a/src/components/organisms/Join/style.ts +++ /dev/null @@ -1,108 +0,0 @@ -import { Button, Label } from 'components/atoms'; -import Styled from 'styled-components'; -import { theme } from 'styled-tools'; - -export const InterestButtonWrapper = Styled.div` - display : flex; - flex-direction : row; - justify-content : center; - flex-wrap: wrap; -`; - -export const InterestButton = Styled(Button)<{ order: number }>` - ${theme('font.subhead4')} - background-color : ${(props) => - props.order == 0 - ? '#13E2DD' - : props.order == 1 - ? '#36C8F5' - : props.order == 2 - ? '#58E2FF' - : props.order == 3 - ? '#03B6CE' - : props.order == 4 - ? '#00BAFA' - : '#ffffff'}}; - padding : 12px 30px; - margin : 12px 5px; - height : 48px; - border-radius: 60px; - border: solid 1px #8b8b8b; - border-color : ${(props) => - props.order == 0 - ? '#13E2DD' - : props.order == 1 - ? '#36C8F5' - : props.order == 2 - ? '#58E2FF' - : props.order == 3 - ? '#03B6CE' - : props.order == 4 - ? '#00BAFA' - : '#8b8b8b'}; - color : ${(props) => (props.order == -1 ? '#8b8b8b' : '#ffffff')} - ; -`; - -export const ModalButton = Styled(Button)<{ selectedInterest: string[] }>` - width: 406px; - height: 60px; - padding: 19px 172px 19px 170px; - border-radius: 4px; - background-color : #dfdfdf; - ${theme('font.subhead3')} - color : #ffffff; - margin-top : 38px; - background-color : ${(props) => (props.selectedInterest.length > 0 ? '#0d0d0d' : '#dfdfdf')}; -`; - -export const ModalLabel = Styled(Label)` - ${theme('font.h1')} - color : #0d0d0d; - margin-bottom : 38px; -`; - -export const ModalWrapper = Styled.div` - position : fixed; - top : 0; - left : 0; - right : 0; - bottom : 0; - margin : auto; - width : 1030px; - height : 614px; - border-radius: 16px; - padding: 40px 100px; - box-shadow: -4px 11px 24px 0 rgba(13, 12, 63, 0.1); - background-color : #ffffff; - display : flex; - flex-direction : column; - align-items : center; -`; - -export const JoinLabel = Styled(Label)` - font-size: 40px; - font-weight: bold; - margin-bottom : 20px; -`; - -export const JoinButton = Styled(Button)<{ isButtonDisabled: boolean }>` - width: 406px; - height: 60px; - border-radius: 4px; - font-size : 16px; - font-weight : bold; - color : #ffffff; - margin-top : 60px; - background-color : ${(props) => (props.isButtonDisabled ? '#dfdfdf' : undefined)}; - background-image : ${(props) => - !props.isButtonDisabled ? 'linear-gradient(to right, #36c8f5,#13e2dd )' : undefined}; -`; - -export const JoinWrap = Styled.div` - display : flex; - flex-direction : column; - align-items : center; - margin-top : 100px; - margin-bottom : 250px; -`; diff --git a/src/components/molecules/JoinCheck/index.tsx b/src/components/organisms/JoinCheck/index.tsx similarity index 100% rename from src/components/molecules/JoinCheck/index.tsx rename to src/components/organisms/JoinCheck/index.tsx diff --git a/src/components/molecules/JoinCheck/style.ts b/src/components/organisms/JoinCheck/style.ts similarity index 90% rename from src/components/molecules/JoinCheck/style.ts rename to src/components/organisms/JoinCheck/style.ts index 05489ed3..6fd08c37 100644 --- a/src/components/molecules/JoinCheck/style.ts +++ b/src/components/organisms/JoinCheck/style.ts @@ -1,6 +1,6 @@ import { Button, CheckBox } from 'components/atoms'; import Styled from 'styled-components'; -import { theme } from 'styled-tools'; +import { palette, theme } from 'styled-tools'; export const BiggerCheckBox = Styled(CheckBox)` display:none; @@ -25,7 +25,7 @@ export const PolicyCheck = Styled.div` export const Line = Styled.div` margin-top : 18px; - background-color: #c4c4c4; + background-color: ${palette('grayscale', 10)}; width: 406px; height: 2px; `; @@ -45,14 +45,14 @@ export const BiggerLabel = Styled.label` export const MoreBtn = Styled(Button)` ${theme('font.body2')}; - color : #a5a5a5; + color : ${palette('grayscale', 3)}; `; export const Titie = Styled.div` ${theme('font.h1')}; margin-bottom : 40px; text-align: left; - color : #0d0d0d; + color : ${palette('grayscale', 9)}; `; export const Content = Styled.p` @@ -88,7 +88,7 @@ export const ModalContainer = Styled.div` align-items : center; margin : auto; border-radius: 16px; - background-color : #ffffff; + background-color : ${palette('grayscale', 0)}; padding : 50px 50px 40px 40px; width : 600px; height : 730px; diff --git a/src/components/molecules/JoinForm/index.tsx b/src/components/organisms/JoinForm/index.tsx similarity index 76% rename from src/components/molecules/JoinForm/index.tsx rename to src/components/organisms/JoinForm/index.tsx index ea17e6b9..dd29d288 100644 --- a/src/components/molecules/JoinForm/index.tsx +++ b/src/components/organisms/JoinForm/index.tsx @@ -1,6 +1,5 @@ import { StyledInput } from 'components/atoms'; -import { DropDown, JoinCheck } from 'components/molecules'; -import React, { useEffect, useState } from 'react'; +import React, { useEffect } from 'react'; import { IJoinConditionMet } from 'types/join.type'; import { IUserDataType } from 'types/user.type'; import { SubTitle, Wrapper } from './style'; @@ -14,22 +13,6 @@ export interface IProps { } function JoinForm({ isConditionMet, userData, setUserData, setIsConditionMet }: IProps): React.ReactElement { - const [gender, setGender] = useState('선택안함'); - const changeGenderStringtoNum = (gender: string) => { - switch (gender) { - case '남성': - return 0; - case '여성': - return 1; - default: - return 2; - } - }; - - useEffect(() => { - setUserData({ ...userData, gender: changeGenderStringtoNum(gender) }); - }, [gender]); - //입력값이 달라질때마다 조건 충족여부 파악하는 useEffect useEffect(() => { if (userData.email.includes('@')) { @@ -86,7 +69,7 @@ function JoinForm({ isConditionMet, userData, setUserData, setIsConditionMet }: height="60px" errorMsg="올바르지 않은 형식입니다" onChange={(value) => { - if (typeof value === 'string') setUserData({ ...userData, email: value }); + setUserData({ ...userData, email: value }); }} isConditionMet={isConditionMet.email} /> @@ -97,7 +80,7 @@ function JoinForm({ isConditionMet, userData, setUserData, setIsConditionMet }: height="60px" errorMsg="영어 대문자, 소문자, 특수문자가 포함되어야 합니다" onChange={(value) => { - if (typeof value === 'string') setUserData({ ...userData, password: value }); + setUserData({ ...userData, password: value }); }} isConditionMet={isConditionMet.password} /> @@ -107,7 +90,7 @@ function JoinForm({ isConditionMet, userData, setUserData, setIsConditionMet }: height="60px" errorMsg="비밀번호가 일치하지 않습니다" onChange={(value) => { - if (typeof value === 'string') setUserData({ ...userData, passwordCheck: value }); + setUserData({ ...userData, passwordCheck: value }); }} isConditionMet={isConditionMet.passwordCheck} margin="14px 0 0 0" @@ -119,21 +102,10 @@ function JoinForm({ isConditionMet, userData, setUserData, setIsConditionMet }: height="60px" errorMsg="닉네임은 최대 6글자로 한글, 숫자, 밑줄 및 마침표만 사용할 수 있습니다" onChange={(value) => { - if (typeof value === 'string') setUserData({ ...userData, nickname: value }); + setUserData({ ...userData, nickname: value }); }} isConditionMet={isConditionMet.nickname} /> - 성별 - - 약관동의 - ); } diff --git a/src/components/molecules/JoinForm/style.ts b/src/components/organisms/JoinForm/style.ts similarity index 100% rename from src/components/molecules/JoinForm/style.ts rename to src/components/organisms/JoinForm/style.ts diff --git a/src/components/organisms/Login/index.tsx b/src/components/organisms/Login/index.tsx deleted file mode 100644 index 2810685e..00000000 --- a/src/components/organisms/Login/index.tsx +++ /dev/null @@ -1,25 +0,0 @@ -import { LineIcon } from 'assets/images'; -import { Link } from 'components/atoms'; -import { LoginForm } from 'components/molecules'; -import React from 'react'; -import { ButtonWrapper, FindPwdBtn, JoinBtn, Line, LoginContainer, LoginLabel } from './style'; - -function CLogin(): React.ReactElement { - return ( - - 로그인 - - - - 비밀번호 찾기 - - - - 회원가입 - - - - ); -} - -export default CLogin; diff --git a/src/components/organisms/LoginForm/index.tsx b/src/components/organisms/LoginForm/index.tsx new file mode 100644 index 00000000..7e9d3fd1 --- /dev/null +++ b/src/components/organisms/LoginForm/index.tsx @@ -0,0 +1,43 @@ +import { StyledInput } from 'components/atoms'; +import React from 'react'; +import { LoginformWrap } from './style'; + +interface IProps { + idInputChange: (value: string) => void; + pwdInputChange: (value: string) => void; + isConditionMet: { + email: boolean; + pwd: boolean; + }; +} +const errMsg = { + email: '가입되지 않은 이메일입니다', + pwd: '비밀번호를 다시 확인해 주세요', +}; + +function LoginForm({ idInputChange, isConditionMet, pwdInputChange }: IProps): React.ReactElement { + return ( + + + + + ); +} + +export default LoginForm; diff --git a/src/components/organisms/LoginForm/style.ts b/src/components/organisms/LoginForm/style.ts new file mode 100644 index 00000000..7d2ace9e --- /dev/null +++ b/src/components/organisms/LoginForm/style.ts @@ -0,0 +1,9 @@ +import { Button } from 'components/atoms'; +import Styled from 'styled-components'; +import { palette } from 'styled-tools'; + +export const LoginformWrap = Styled.div` + display : flex; + flex-direction : column; + align-items : center; +`; diff --git a/src/components/organisms/MyPageCommentModal/index.tsx b/src/components/organisms/MyPageCommentModal/index.tsx new file mode 100644 index 00000000..883047e7 --- /dev/null +++ b/src/components/organisms/MyPageCommentModal/index.tsx @@ -0,0 +1,60 @@ +import { Modal } from 'components/atoms'; +import { ChallengeModalComment } from 'components/molecules'; +import dayjs from 'dayjs'; +import React from 'react'; +import { IChallenge } from 'types/challenge.type'; +import * as S from './style'; + +export interface IProps { + isFolded: boolean; + isChallengeModalOpen: boolean; + challenge: IChallenge | null; + handleCommentFold: () => void; + setIsChallengeModalOpen: (value: boolean) => void; + handleChallengeModalOpen: () => void; +} + +function MyPageCommentModal({ + isFolded, + isChallengeModalOpen, + challenge, + handleCommentFold, + setIsChallengeModalOpen, + handleChallengeModalOpen, +}: IProps): React.ReactElement { + return ( + + + + + + +
+
{challenge?.user?.nickname}
+
{dayjs().format('MM.DD')}
+
+
{challenge?.interest?.map((item: string) => `#${item} `)}
+
+
+ +

잘한 점

+

{challenge?.good}

+

못한 점

+

{challenge?.bad}

+

배운 점

+

{challenge?.learn}

+
+ {isFolded ? '더보기' : '접기'} + + {challenge?.comments.map((comment) => ( + + ))} + +
+ 닫기 +
+
+ ); +} + +export default MyPageCommentModal; diff --git a/src/pages/MyPage/style.ts b/src/components/organisms/MyPageCommentModal/style.ts similarity index 58% rename from src/pages/MyPage/style.ts rename to src/components/organisms/MyPageCommentModal/style.ts index d0bd41f0..9cafaf1c 100644 --- a/src/pages/MyPage/style.ts +++ b/src/components/organisms/MyPageCommentModal/style.ts @@ -14,69 +14,29 @@ export const ChallengeModalWrapper = Styled.div` height: 607px; `; -export const CommentWrapper = Styled.div` - margin: 0 60px; - width: calc(100% - 120px); -`; - -export const CloseButton = Styled(Button)` - ${theme('font.subhead3')}; - position: absolute; - bottom: 0px; - width: 100%; - height: 63px; - color: #fff; - background-color: ${palette('grayscale', 7)}; - border-radius: 0 0 18px 18px; -`; - -export const MoreButton = Styled(Button)` - ${theme('font.subhead4')}; - color: ${palette('primary', 5)}; - margin: 50px 0; -`; - -export const TextArea = Styled.div<{ isFolded: boolean }>` - margin: 0 60px; - width: calc(100% - 120px); - h3 { - ${theme('font.subhead3')}; - margin: 30px 0 6px 0; - color: ${palette('grayscale', 7)}; - } - p { - ${theme('font.body3')}; - color: ${palette('grayscale', 6)}; - word-wrap: break-word; - overflow: ${ifProp('isFolded', 'hidden')}; - text-overflow: ${ifProp('isFolded', 'ellipsis')}; - white-space: ${ifProp('isFolded', 'nowrap')}; - } -`; - export const ModalWrapper = Styled.div` -width: 100%; -height: 544px; -border-radius: 18px 18px 0 0; -overflow: auto; -display: flex; -flex-direction: column; -align-items: center; -background-color: #fff; + width: 100%; + height: 544px; + border-radius: 18px 18px 0 0; + overflow: auto; + display: flex; + flex-direction: column; + align-items: center; + background-color: #fff; `; export const ModalUserInfo = Styled.div` -display: flex; -margin: 40px 30px 20px 30px; -width: calc(100% - 60px); -height: 80px; + display: flex; + margin: 40px 30px 20px 30px; + width: calc(100% - 60px); + height: 80px; `; export const ModalUserImg = Styled(Img)` -margin-right: 15px; -border-radius: 50%; -width: 80px; -height: 80px; + margin-right: 15px; + border-radius: 50%; + width: 80px; + height: 80px; `; export const ModalUserInfoWrapper = Styled.div` @@ -103,67 +63,42 @@ export const ModalUserInfoWrapper = Styled.div` } `; -export const SwitchRadio = Styled.input` - display: none; - - + label { - cursor: pointer; - color: ${palette('grayscale', 3)}; - } - :checked + label { - color: ${palette('grayscale', 6)}; - padding-bottom: 2px; - background: - linear-gradient(to right, ${palette('primary', 3)}, ${palette('primary', 0)}) - left - bottom - #fff - no-repeat; - background-size: 100% 2px; -} -`; - -export const Switch = Styled.ul` - display: flex; - justify-content: center; - margin-top: 100px; - li { - margin: 0 20px; - } - - label { - ${theme('font.subhead5')}; - } -`; - -export const Wrapper = Styled.div` -`; - -export const Header = Styled.div` - display: flex; - justify-content: center; - width: 100vw; - height: 581px; - background-color: ${palette('grayscale', -2)}; +export const CommentWrapper = Styled.div` + margin: 0 60px; + width: calc(100% - 120px); `; -export const Body = Styled.div` - display: flex; - flex-direction: column; - align-items: center; +export const CloseButton = Styled(Button)` + ${theme('font.subhead3')}; + position: absolute; + bottom: 0px; + width: 100%; + height: 63px; + color: #fff; + background-color: ${palette('grayscale', 7)}; + border-radius: 0 0 18px 18px; `; -export const Top = Styled.div` - display: flex; - justify-content: center; - width: 100vw; - margin: 120px 0 150px 0; +export const MoreButton = Styled(Button)` + ${theme('font.subhead4')}; + color: ${palette('primary', 5)}; + margin: 50px 0; `; -export const Bottom = Styled.div` - display: flex; - justify-content: center; - width: 100vw; - padding: 150px 0; - background-color: #f7f7f7; +export const TextArea = Styled.div<{ isFolded: boolean }>` + margin: 0 60px; + width: calc(100% - 120px); + h3 { + ${theme('font.subhead3')}; + margin: 30px 0 6px 0; + color: ${palette('grayscale', 7)}; + } + p { + ${theme('font.body3')}; + color: ${palette('grayscale', 6)}; + word-wrap: break-word; + overflow: ${ifProp('isFolded', 'hidden')}; + text-overflow: ${ifProp('isFolded', 'ellipsis')}; + white-space: ${ifProp('isFolded', 'nowrap')}; + } `; diff --git a/src/components/organisms/NoticeCommentList/index.tsx b/src/components/organisms/NoticeCommentList/index.tsx index 7436cab7..1d93d453 100644 --- a/src/components/organisms/NoticeCommentList/index.tsx +++ b/src/components/organisms/NoticeCommentList/index.tsx @@ -3,16 +3,17 @@ import { CommentWrite, LoginModal, NoticeSingleComment } from 'components/molecu import React, { useState } from 'react'; import { useRecoilValue } from 'recoil'; import { userStatusState } from 'stores/user'; -import { INoticeComment, INoticeNewComment } from 'types/notice.type'; +import { INoticeComment } from 'types/notice.type'; import { CommentWriteContainer } from './style'; interface IProps { commentList: Array; noticeID?: string; - reLoadComment: (newComment: INoticeNewComment) => void; + isRerender: boolean; + setIsRerender: (value: boolean) => void; } -function NoticeCommentList({ commentList, noticeID, reLoadComment }: IProps): React.ReactElement { +function NoticeCommentList({ commentList, noticeID, isRerender, setIsRerender }: IProps): React.ReactElement { const [commentValue, setCommentValue] = useState(''); const [isLoginModalOpen, setIsLoginModalOpen] = useState(false); const userStatusData = useRecoilValue(userStatusState); @@ -20,41 +21,38 @@ function NoticeCommentList({ commentList, noticeID, reLoadComment }: IProps): Re const handleChange = (event: React.ChangeEvent) => { setCommentValue(event.currentTarget.value); }; - const onSubmit = async (event: React.FormEvent) => { + const handleSubmit = async (event: React.MouseEvent) => { event.preventDefault(); - const variables = { - text: commentValue, - }; if (userStatusData) { - await postNoticeComment(userStatusData.token, noticeID, variables); - reLoadComment(variables); + await postNoticeComment(userStatusData.token, noticeID, { parentID: null, text: commentValue }); setCommentValue(''); + setIsRerender(!isRerender); } else { setIsLoginModalOpen(true); } }; - if (isLoginModalOpen === true) { - document.body.style.overflow = 'hidden'; - } else document.body.style.overflow = 'unset'; + return ( <> {commentList?.map((data: INoticeComment, index) => ( ))} diff --git a/src/components/organisms/NoticeList/index.tsx b/src/components/organisms/NoticeList/index.tsx index 70e3f2db..c68125c6 100644 --- a/src/components/organisms/NoticeList/index.tsx +++ b/src/components/organisms/NoticeList/index.tsx @@ -1,6 +1,6 @@ import { SmallLeftArrowIcon, SmallRightArrowIcon } from 'assets/images'; import { Icon } from 'components/atoms'; -import { Notice } from 'components/molecules'; +import { Concert } from 'components/molecules'; import React, { useState } from 'react'; import { useHistory } from 'react-router'; import { INotice } from 'types/notice.type'; @@ -51,7 +51,7 @@ function NoticeList({ noticeList, totalNoticeNum, currentPage, setCurrentPage }: {noticeList?.map( (notice: INotice) => notice && ( - history.push(`/notice/${notice._id}`)} - > + > ), )} diff --git a/src/components/organisms/RegisterDetailCard/index.tsx b/src/components/organisms/RegisterDetailCard/index.tsx new file mode 100644 index 00000000..b79db7d4 --- /dev/null +++ b/src/components/organisms/RegisterDetailCard/index.tsx @@ -0,0 +1,88 @@ +import { getRegistPeriod, SignRegister } from 'apis'; +import { AlertIcon } from 'assets/images'; +import { RegisterCard, RegisterCompletedModal, RegisterConfirmModal } from 'components/molecules'; +import React, { useEffect, useState } from 'react'; +import { useRecoilState } from 'recoil'; +import { userStatusState } from 'stores/user'; +import { IAdminChallengePeriod } from 'types/admin.type'; +import { CardWrapper, NoticeCardWrapper, NoticeHeaderWrapper } from './style'; + +function RegisterDetailCard() { + const [userStatusData, setUserStatusData] = useRecoilState(userStatusState); + const [registerCount, setRegisterCount] = useState(0); + const [isOpenModal, setIsOpenModal] = useState(false); + const [isRegisterSubmit, setIsRegisterSubmit] = useState(false); + const [periodData, setPeriodData] = useState(null); + + const handleSubmit = async () => { + const signData = { + challengeCNT: registerCount, + }; + if (userStatusData) { + const getData = await SignRegister(signData, userStatusData.token); + if (getData) { + setIsRegisterSubmit(true); + setIsOpenModal(false); + } else { + setIsOpenModal(false); + } + } + }; + + const dateToString = (date: string): string => { + let month = date.substr(5, 2); + if (month.substr(0, 1) === '0') month = month.substr(1, 1); + let day = date.substr(8, 2); + if (day.substr(0, 1) === '0') day = day.substr(1, 1); + return `${month}월 ${day}일`; + }; + + const getChallengePeriod = async () => { + const data = await getRegistPeriod(); + data && setPeriodData(data); + }; + + useEffect(() => { + getChallengePeriod(); + }, []); + + return periodData ? ( + <> + + + + {isRegisterSubmit === true ? ( + + ) : null} + + + + 오투 챌린지 주의사항 + + +

01

+

주당 회고록 개수 3개 이상 선택 및 80% 이상 달성 시 뱃지 획득이 가능합니다.

+

02

+

본 챌린지 의도와는 다른 광고성 글과 카테고리와 무관한 내용은 무통보 삭제 될 수 있습니다.

+
+
+ + ) : ( +

챌린지 신청기간이 아닙니다

+ ); +} + +export default RegisterDetailCard; diff --git a/src/components/organisms/RegisterDetailCard/style.ts b/src/components/organisms/RegisterDetailCard/style.ts new file mode 100644 index 00000000..feacdb1e --- /dev/null +++ b/src/components/organisms/RegisterDetailCard/style.ts @@ -0,0 +1,38 @@ +import Styled from 'styled-components'; +import { palette, theme } from 'styled-tools'; + +export const CardWrapper = Styled.div` + display:inline-block; + padding:60px 0px 0px 20px; + vertical-align: top; +`; + +export const NoticeCardWrapper = Styled.div` + border-radius: 10px; + box-shadow: 0 0 24px 0 rgba(13, 12, 63, 0.1); + padding: 30px 30px 30px 28px; + width: 354px; + height: 282px; + + h1{ + margin-top:20px; + text-align: left; + color: ${palette('grayscale', 3)}; + ${theme('font.subhead3_eng')}; + } + p{ + text-align: left; + color: ${palette('grayscale', 4)}; + ${theme('font.body3')}; + } +`; + +export const NoticeHeaderWrapper = Styled.div` + text-align: left; + color: ${palette('grayscale', 7)}; + ${theme('font.body4')}; + + img{ + float:right; + } +`; diff --git a/src/components/organisms/SettingForm/index.tsx b/src/components/organisms/SettingForm/index.tsx new file mode 100644 index 00000000..291ff77c --- /dev/null +++ b/src/components/organisms/SettingForm/index.tsx @@ -0,0 +1,95 @@ +import { DropDown, DropDownMulti, FormInput, ProfileEdit, RemovableTag, ToggleSwitch } from 'components/molecules'; +import React from 'react'; +import { interestList } from 'resources/string'; +import { ISettingUserInfo } from 'types/setting.type'; +import * as S from './style'; + +export interface IProps { + userInfo: ISettingUserInfo; + imgInput: React.RefObject; + isBtnAtv: boolean; + handleInputImg: (e: React.ChangeEvent) => void; + handleUserNickname: (nickname: string) => void; + handleClickDel: (e: string) => void; + handleUserInterest: (e: string) => void; + handleUserGender: (e: string) => void; + handleUserMarpolicy: (e: React.ChangeEvent) => void; + handleClickEdit: () => Promise; + handlePasswordBtnClicked: () => void; +} + +function SettingForm({ + userInfo, + imgInput, + isBtnAtv, + handleInputImg, + handleUserNickname, + handleClickDel, + handleUserInterest, + handleUserGender, + handleUserMarpolicy, + handleClickEdit, + handlePasswordBtnClicked, +}: IProps): React.ReactElement { + return ( + + + + + + + + + {userInfo.interest.map((item: string, idx: number) => { + return ; + })} + + + + + 비밀번호 변경 + 비밀번호 변경하기 + + + 이메일 수신 설정 + 오투에서 진행하는 챌린지, 이벤트, 프로모션에 관한 광고를 수신하겠습니다. + + + + + 수정완료 + + + ); +} + +export default SettingForm; diff --git a/src/pages/Setting/style.ts b/src/components/organisms/SettingForm/style.ts similarity index 59% rename from src/pages/Setting/style.ts rename to src/components/organisms/SettingForm/style.ts index a123fbc6..1a918af0 100644 --- a/src/pages/Setting/style.ts +++ b/src/components/organisms/SettingForm/style.ts @@ -1,4 +1,3 @@ -import { Input } from 'components/atoms'; import Styled, { css } from 'styled-components'; import { palette, theme } from 'styled-tools'; @@ -12,11 +11,6 @@ export const Container = Styled.div` justify-content: center; `; -export const ProfileInput = Styled(Input)` - width: 0; - height: 0; -`; - export const TextWrapper = Styled.div` display: flex; flex-direction: column; @@ -34,39 +28,10 @@ export const InterestList = Styled.div` margin-bottom: 50px; `; -export const CategoryContainer = Styled.div` +export const CategoryWrapper = Styled.div` margin-bottom: 20px; `; -export const NicknameInputContainer = Styled.div` - margin-bottom: 50px; -`; - -export const ProfileContainer = Styled.div` - margin-bottom: 90px; -`; - -interface IProfileImg { - url: string; -} -export const ProfileImg = Styled.div` - width: 150px; - height: 150px; - border-radius: 75px; - background: url(${(props) => props.url}) center center / cover; -`; - -export const EditBtn = Styled.img` - cursor: pointer; - - position: relative; - top: -54px; - left: 105px; - - width: 45px; - height: 45px; -`; - export const Txt = Styled.div` ${theme('font.subhead4')}; width: 844px; @@ -83,19 +48,6 @@ export const TxtSmall = Styled.div` color: ${palette('grayscale', 5)}; `; -export const Email = Styled.div` - ${theme('font.subhead3')}; - width: 844px; - height: 60px; - margin-bottom: 50px; - padding: 18px 20px 18px 20px; - border-radius: 4px; - background-color: ${palette('grayscale', 1)}; - display: flex; - align-items: center; - color: ${palette('grayscale', 4)}; -`; - export const PolicyCntnr = Styled.div` width: 844px; margin-bottom: 50px; @@ -141,23 +93,3 @@ export const Btn = Styled.div` justify-content: center; color: ${palette('grayscale', 0)}; `; - -export const InterestTagCntnr = Styled.div` - ${theme('font.subhead3')}; - margin-right: 10px; - padding: 12px 30px; - border-radius: 60px; - border: solid 1px ${palette('primary', 5)}; - display: flex; - flex-direction: row; - align-items: center; - color: ${palette('primary', 5)}; - - div { - margin-right: 10px; - } - - img { - width: 14px; - } -`; diff --git a/src/components/organisms/index.ts b/src/components/organisms/index.ts index 9bc36844..062c1efc 100644 --- a/src/components/organisms/index.ts +++ b/src/components/organisms/index.ts @@ -1,8 +1,9 @@ -export { default as AdminChallengeList } from './AdminChallengeList'; -export { default as AdminChallengeOpen } from './AdminChallengeOpen'; -export { default as AdminWrite } from './AdminWrite'; +export { default as AdminWriteForm } from './AdminWriteForm'; export { default as CategoryList } from './CategoryList'; -export { default as ChallengeCard } from './ChallengeCard'; +export { default as ChallengeDetailCard } from './ChallengeDetailCard'; +export { default as ChallengeEditCard } from './ChallengeEditCard'; +export { default as ChallengeOpenPhotoUpload } from './ChallengeOpenPhotoUpload'; +export { default as ChallengeWriteCard } from './ChallengeWriteCard'; export { default as CommentList } from './CommentList'; export { default as ConcertCardList } from './ConcertCardList'; export { default as ConcertList } from './ConcertList'; @@ -10,13 +11,19 @@ export { default as DetailContent } from './DetailContent'; export { default as FindPwd } from './FindPwd'; export { default as Footer } from './Footer'; export { default as Hamburger } from './Hamburger'; +export { default as HashTagAddForm } from './HashTagAddForm'; export { default as Header } from './Header'; -export { default as Join } from './Join'; -export { default as Login } from './Login'; +export { default as InterestModal } from './InterestModal'; +export { default as JoinCheck } from './JoinCheck'; +export { default as JoinForm } from './JoinForm'; +export { default as LoginForm } from './LoginForm'; export { default as MyCommentList } from './MyCommentList'; +export { default as MyPageCommentModal } from './MyPageCommentModal'; export { default as MyPageHeader } from './MyPageHeader'; export { default as NoticeCommentList } from './NoticeCommentList'; export { default as NoticeHeader } from './NoticeHeader'; export { default as NoticeList } from './NoticeList'; +export { default as RegisterDetailCard } from './RegisterDetailCard'; export { default as SearchForm } from './SearchForm'; export { default as SetNewPwd } from './SetNewPwd'; +export { default as SettingForm } from './SettingForm'; diff --git a/src/pages/AdminChallengeList/index.tsx b/src/pages/AdminChallengeList/index.tsx index e1390138..c9094ecc 100644 --- a/src/pages/AdminChallengeList/index.tsx +++ b/src/pages/AdminChallengeList/index.tsx @@ -1,8 +1,24 @@ -import { AdminChallengeList as CAdminChallengeList } from 'components/organisms'; -import React from 'react'; +import { getChallengeList } from 'apis'; +import React, { useEffect, useState } from 'react'; +import { useRecoilValue } from 'recoil'; +import { userStatusState } from 'stores/user'; +import { IAdminChallenge } from 'types/admin.type'; +import AdminChallengeListTemplate from './template'; function AdminChallengeList(): React.ReactElement { - return ; + const userStatusData = useRecoilValue(userStatusState); + const [challengeDataList, setChallengeDataList] = useState(null); + + useEffect(() => { + if (userStatusData) getChallengeDataList(userStatusData.token, 30, 0); + else alert('로그인 후 이용하세요'); + }, [userStatusData]); + + const getChallengeDataList = async (token: string, limit: number, offset: number): Promise => { + const data = await getChallengeList(token, limit, offset); + data && setChallengeDataList(data); + }; + return ; } export default AdminChallengeList; diff --git a/src/pages/AdminChallengeList/template/index.tsx b/src/pages/AdminChallengeList/template/index.tsx index d82cc99a..1e1ee666 100644 --- a/src/pages/AdminChallengeList/template/index.tsx +++ b/src/pages/AdminChallengeList/template/index.tsx @@ -1,7 +1,38 @@ +import { GreydfPlusIcon as PlusIcon } from 'assets/images'; +import { AdminChallengeCard } from 'components/molecules'; import React from 'react'; +import { Link } from 'react-router-dom'; +import { IAdminChallenge } from 'types/admin.type'; +import { AddCard, AddExp, AddImage, ListContainer, PageLabel, Title, Wrapper } from './style'; -function Home(): React.ReactElement { - return
Home
; +interface IProps { + challengeDataList: IAdminChallenge[] | null; } -export default Home; +function AdminChallengeListTemplate({ challengeDataList }: IProps): React.ReactElement { + return ( + + 관리자 페이지 + 챌린지 정보 + + + + + 챌린지 등록하기 + + + {challengeDataList?.map((data, id) => { + return ( + data && ( + + + + ) + ); + })} + + + ); +} + +export default AdminChallengeListTemplate; diff --git a/src/components/organisms/AdminChallengeList/style.ts b/src/pages/AdminChallengeList/template/style.ts similarity index 82% rename from src/components/organisms/AdminChallengeList/style.ts rename to src/pages/AdminChallengeList/template/style.ts index dceb2644..baef0977 100644 --- a/src/components/organisms/AdminChallengeList/style.ts +++ b/src/pages/AdminChallengeList/template/style.ts @@ -1,10 +1,10 @@ import { Label } from 'components/atoms'; import Styled from 'styled-components'; -import { theme } from 'styled-tools'; +import { palette, theme } from 'styled-tools'; export const AddExp = Styled.div` ${theme('font.subhead5')} -color : #dfdfdf; +color : ${palette('grayscale', 1)}; `; export const AddImage = Styled.img` @@ -19,7 +19,7 @@ flex-direction : column; align-items : center; border-radius: 18px; box-shadow: 0 0 24px 0 rgba(13, 12, 63, 0.1); -background-color : #ffffff; +background-color : ${palette('grayscale', 0)}; width: 402px; height: 484px; height: 484px; @@ -37,7 +37,7 @@ export const PageLabel = Styled(Label)` margin-top : 60px; line-height: 1.5; letter-spacing: -0.5px; -color : #3d3d3d; +color : ${palette('grayscale', 7)}; font-size: 16px; `; @@ -45,7 +45,7 @@ export const Title = Styled(Label)` ${theme('font.dp4')} margin-top:10px; margin-bottom : 110px; -color:#3d3d3d; +color:${palette('grayscale', 7)}; `; export const Wrapper = Styled.div` diff --git a/src/pages/AdminChallengeOpen/index.tsx b/src/pages/AdminChallengeOpen/index.tsx index 026e7deb..17301ba6 100644 --- a/src/pages/AdminChallengeOpen/index.tsx +++ b/src/pages/AdminChallengeOpen/index.tsx @@ -1,8 +1,161 @@ -import { AdminChallengeOpen as CAdminChallengeOpen } from 'components/organisms'; -import React from 'react'; +import { challengeOpen } from 'apis'; +import React, { useEffect, useState } from 'react'; +import { useHistory } from 'react-router-dom'; +import { useRecoilValue } from 'recoil'; +import { userStatusState } from 'stores/user'; +import AdminChallengeOpenTemplate from './template'; function AdminChallengeOpen(): React.ReactElement { - return ; + const history = useHistory(); + const userStatusData = useRecoilValue(userStatusState); + const [image, setImage] = useState(null); + const [isChecked, setIsChecked] = useState(false); + const [isButtonDisabled, setIsButtonDisabled] = useState(true); + const [isConditionMet, setIsConditionMet] = useState({ + title: false, + challengePeriod: { + start: false, + end: false, + }, + applyPeriod: { + start: false, + end: false, + }, + peopleNum: false, + }); + const [challengeOpenData, setChallengeOpenData] = useState({ + title: '', + challengePeriod: { + start: '', + end: '', + }, + applyPeriod: { + start: '', + end: '', + }, + peopleNum: 0, + }); + const checkHandler = () => { + setIsChecked(!isChecked); + }; + const btnHandler = async () => { + if (userStatusData) { + const isSuccess = await challengeOpen(userStatusData.token, { ...challengeOpenData, img: image }); + isSuccess && history.goBack(); + } else { + alert('로그인 후 이용하세요'); + } + }; + const CheckDatePattern = (date: string) => /[0-9]{4}.[0-9]{2}.[0-9]{2}$/.test(date); + const handleTitleOnChange = (value: string) => { + setChallengeOpenData({ ...challengeOpenData, title: value }); + }; + const handleChallengeStOnChange = (value: string) => { + setChallengeOpenData({ + ...challengeOpenData, + challengePeriod: { ...challengeOpenData.challengePeriod, start: value }, + }); + }; + const handleChallengeEndOnChange = (value: string) => { + setChallengeOpenData({ + ...challengeOpenData, + challengePeriod: { ...challengeOpenData.challengePeriod, end: value }, + }); + }; + const handleApplyStOnChange = (value: string) => { + setChallengeOpenData({ + ...challengeOpenData, + applyPeriod: { ...challengeOpenData.applyPeriod, start: value }, + }); + }; + const handleApplyEndOnChange = (value: string) => { + setChallengeOpenData({ + ...challengeOpenData, + applyPeriod: { ...challengeOpenData.applyPeriod, end: value }, + }); + }; + const handleNumOnChange = (value: string) => { + if (!isNaN(Number(value))) { + setChallengeOpenData({ ...challengeOpenData, peopleNum: Number(value) }); + } + }; + + useEffect(() => { + if ( + isConditionMet.title && + isConditionMet.challengePeriod.start && + isConditionMet.challengePeriod.end && + isConditionMet.applyPeriod.start && + isConditionMet.applyPeriod.end && + isConditionMet.peopleNum && + image != null && + isChecked + ) { + setIsButtonDisabled(false); + } else { + setIsButtonDisabled(true); + } + }, [isConditionMet, image, isChecked]); + useEffect(() => { + if (challengeOpenData.title !== '') { + setIsConditionMet({ ...isConditionMet, title: true }); + } else { + setIsConditionMet({ ...isConditionMet, title: false }); + } + }, [challengeOpenData.title]); + useEffect(() => { + if (challengeOpenData.peopleNum !== 0) { + setIsConditionMet({ ...isConditionMet, peopleNum: true }); + } else { + setIsConditionMet({ ...isConditionMet, peopleNum: false }); + } + }, [challengeOpenData.peopleNum]); + + useEffect(() => { + if (CheckDatePattern(challengeOpenData.challengePeriod.start)) { + setIsConditionMet({ ...isConditionMet, challengePeriod: { ...isConditionMet.challengePeriod, start: true } }); + } else { + setIsConditionMet({ ...isConditionMet, challengePeriod: { ...isConditionMet.challengePeriod, start: false } }); + } + }, [challengeOpenData.challengePeriod.start]); + useEffect(() => { + if (CheckDatePattern(challengeOpenData.challengePeriod.end)) { + setIsConditionMet({ ...isConditionMet, challengePeriod: { ...isConditionMet.challengePeriod, end: true } }); + } else { + setIsConditionMet({ ...isConditionMet, challengePeriod: { ...isConditionMet.challengePeriod, end: false } }); + } + }, [challengeOpenData.challengePeriod.end]); + useEffect(() => { + if (CheckDatePattern(challengeOpenData.applyPeriod.start)) { + setIsConditionMet({ ...isConditionMet, applyPeriod: { ...isConditionMet.applyPeriod, start: true } }); + } else { + setIsConditionMet({ ...isConditionMet, applyPeriod: { ...isConditionMet.applyPeriod, start: false } }); + } + }, [challengeOpenData.applyPeriod.start]); + useEffect(() => { + if (CheckDatePattern(challengeOpenData.applyPeriod.end)) { + setIsConditionMet({ ...isConditionMet, applyPeriod: { ...isConditionMet.applyPeriod, end: true } }); + } else { + setIsConditionMet({ ...isConditionMet, applyPeriod: { ...isConditionMet.applyPeriod, end: false } }); + } + }, [challengeOpenData.applyPeriod.end]); + + return ( + + ); } export default AdminChallengeOpen; diff --git a/src/pages/AdminChallengeOpen/template/index.tsx b/src/pages/AdminChallengeOpen/template/index.tsx index d82cc99a..78cd9a9c 100644 --- a/src/pages/AdminChallengeOpen/template/index.tsx +++ b/src/pages/AdminChallengeOpen/template/index.tsx @@ -1,7 +1,78 @@ +import { CheckOffIcon, CheckOnIcon } from 'assets/images'; +import { AdminChallengeOpenForm } from 'components/molecules'; +import { ChallengeOpenPhotoUpload } from 'components/organisms'; import React from 'react'; +import { IConditionMet } from 'types/challenge.type'; +import { + CheckContainer, + CheckExp, + CheckImage, + ElementLabel, + OpenButton, + PageLabel, + SCheckBox, + Title, + UploadContainer, + Wrapper, +} from './style'; -function Home(): React.ReactElement { - return
Home
; +interface IProps { + isConditionMet: IConditionMet; + setImage: (image: File | null) => void; + isChecked: boolean; + checkHandler: () => void; + isButtonDisabled: boolean; + btnHandler: () => Promise; + handleTitleOnChange: (value: string) => void; + handleChallengeStOnChange: (value: string) => void; + handleChallengeEndOnChange: (value: string) => void; + handleApplyStOnChange: (value: string) => void; + handleApplyEndOnChange: (value: string) => void; + handleNumOnChange: (value: string) => void; } -export default Home; +function AdminChallengeOpenTemplate({ + handleTitleOnChange, + isConditionMet, + setImage, + isChecked, + checkHandler, + isButtonDisabled, + btnHandler, + handleChallengeStOnChange, + handleChallengeEndOnChange, + handleApplyStOnChange, + handleApplyEndOnChange, + handleNumOnChange, +}: IProps): React.ReactElement { + return ( + + 관리자 페이지 + 챌린지 등록 + + + 사진 업로드 + + + + + + 위 내용을 확인하셨습니까? + + + + 등록하기 + + + ); +} + +export default AdminChallengeOpenTemplate; diff --git a/src/components/organisms/AdminChallengeOpen/style.ts b/src/pages/AdminChallengeOpen/template/style.ts similarity index 55% rename from src/components/organisms/AdminChallengeOpen/style.ts rename to src/pages/AdminChallengeOpen/template/style.ts index 79760df8..37687ab4 100644 --- a/src/components/organisms/AdminChallengeOpen/style.ts +++ b/src/pages/AdminChallengeOpen/template/style.ts @@ -1,38 +1,10 @@ import { Button, CheckBox, Label } from 'components/atoms'; -import Styled from 'styled-components'; -import { theme } from 'styled-tools'; - -export const PhotoUploadBottomDesc = Styled.div` - ${theme('font.body2_eng')} - color : #a5a5a5; -`; - -export const PhotoUploadMiddleDesc = Styled.div` - ${theme('font.subhead3')} - color : #a5a5a5; - text-align: center; - margin-top :4px; - margin-bottom : 20px; -`; - -export const PhotoUploadImage = Styled.img` - width : 38px; - height : 38px; -`; - -export const PhotoUploadContainer = Styled.div` - width: 262px; - height: 216px; - background-color : #f2f2f2; - display : flex; - flex-direction : column; - align-items : center; - justify-content : center; -`; +import Styled, { css } from 'styled-components'; +import { palette, theme } from 'styled-tools'; export const CheckExp = Styled.label` ${theme('font.body4')} - color : #8b8b8b; + color : ${palette('grayscale', 4)}; display : flex; align-items : center; `; @@ -51,7 +23,7 @@ export const PageLabel = Styled(Label)` margin-top : 60px; line-height: 1.5; letter-spacing: -0.5px; - color : #3d3d3d; + color : ${palette('grayscale', 7)}; font-size: 16px; `; @@ -59,7 +31,7 @@ export const Title = Styled(Label)` ${theme('font.dp4')} margin-top:10px; margin-bottom : 110px; - color:#3d3d3d; + color:${palette('grayscale', 7)}; `; export const UploadContainer = Styled.div` @@ -74,7 +46,7 @@ export const CheckContainer = Styled.div` `; export const ElementLabel = Styled(Label)` ${theme('font.subhead4')} - color: #0d0d0d; + color: ${palette('grayscale', 9)}; margin-bottom :11px; `; @@ -84,10 +56,16 @@ export const OpenButton = Styled(Button)<{ isButtonDisabled?: boolean }>` width: 406px; height: 60px; border-radius: 4px; - color : #ffffff; - background-image : ${(props) => - !props.isButtonDisabled ? 'linear-gradient(to right, #36c8f5,#13e2dd )' : '#dfdfdf'}; - background-color : ${(props) => (props.isButtonDisabled ? '#dfdfdf' : undefined)}; + color : ${palette('grayscale', 0)}; + ${(props) => + !props.isButtonDisabled + ? css` + background-image: linear-gradient(to right, ${palette('primary', 3)}, ${palette('primary', 0)}); + ` + : css` + background-color: ${palette('grayscale', 1)}; + background-image: ${palette('grayscale', 1)}; + `}; margin-bottom : 304px; `; diff --git a/src/pages/AdminWrite/index.tsx b/src/pages/AdminWrite/index.tsx index 2092131e..a7b73212 100644 --- a/src/pages/AdminWrite/index.tsx +++ b/src/pages/AdminWrite/index.tsx @@ -1,13 +1,127 @@ -import { AdminWrite as CAdminWrite } from 'components/organisms'; -import React from 'react'; +import { postConcertWrite, postNoticeWrite } from 'apis'; +import React, { useEffect, useState } from 'react'; import { RouteComponentProps } from 'react-router'; +import { useHistory } from 'react-router-dom'; +import { useRecoilValue } from 'recoil'; +import { userStatusState } from 'stores/user'; +import AdminWriteTemplate from './template'; interface MatchParams { menu: string; } function AdminWrite({ match }: RouteComponentProps): React.ReactElement { const menu = match.params.menu; - return ; + const history = useHistory(); + const userStatusData = useRecoilValue(userStatusState); + const [isButtonDisabled, setIsButtonDisabled] = useState(true); + const [isConditionMet, setIsConditionMet] = useState({ + title: false, + category: false, + menu: false, + content: false, + hashtag: false, + video: false, + thumbnail: false, + nickname: false, + }); + const [writeData, setWriteData] = useState<{ + title: string; + category: string[]; + menu: string; + content: string; + hashtag: string[]; + video: File | null; + thumbnail: File | null; + nickname: string; + }>({ + title: '', + category: [''], + menu: '', + content: '', + hashtag: [''], + video: null, + thumbnail: null, + nickname: '', + }); + const handleBtnOnClick = () => { + if (writeData.menu === '공지사항') { + postNoticeHandler(); + } else { + postConcertHandler(); + } + }; + const postConcertHandler = async () => { + if (userStatusData) { + const isSuccess = await postConcertWrite(userStatusData.token, { + videoLink: writeData.video, + imgThumbnail: writeData.thumbnail, + title: writeData.title, + text: writeData.content, + interest: writeData.category, + hashtag: writeData.hashtag, + authorNickname: writeData.nickname, + }); + isSuccess && history.goBack(); + } else { + alert('로그인 후 이용하세요'); + } + }; + const postNoticeHandler = async () => { + if (userStatusData) { + const isSuccess = await postNoticeWrite(userStatusData.token, { + title: writeData.title, + text: writeData.content, + interest: writeData.category, + hashtag: writeData.hashtag, + }); + isSuccess && history.goBack(); + } else { + alert('로그인 후 이용하세요'); + } + }; + + useEffect(() => { + if (writeData.menu === 'Share Together') { + if ( + isConditionMet.title && + isConditionMet.category && + isConditionMet.menu && + isConditionMet.content && + isConditionMet.hashtag && + isConditionMet.video && + isConditionMet.thumbnail && + isConditionMet.nickname + ) { + setIsButtonDisabled(false); + } else { + setIsButtonDisabled(true); + } + } else { + if ( + isConditionMet.title && + isConditionMet.category && + isConditionMet.menu && + isConditionMet.content && + isConditionMet.hashtag + ) { + setIsButtonDisabled(false); + } else { + setIsButtonDisabled(true); + } + } + }, [isConditionMet, writeData.menu]); + + return ( + + ); } export default AdminWrite; diff --git a/src/pages/AdminWrite/template/index.tsx b/src/pages/AdminWrite/template/index.tsx index d82cc99a..ad0d9854 100644 --- a/src/pages/AdminWrite/template/index.tsx +++ b/src/pages/AdminWrite/template/index.tsx @@ -1,7 +1,45 @@ +import { AdminWriteForm, HashTagAddForm } from 'components/organisms'; import React from 'react'; +import { IAdminWriteConditionMet } from 'types/admin.type'; +import { IUserData } from 'types/user.type'; +import { PageLabel, Title, Wrapper, WriteButton, WriteLabel } from './style'; -function Home(): React.ReactElement { - return
Home
; +interface IProps { + menu: string; + isConditionMet: IAdminWriteConditionMet; + setIsConditionMet: (value: IAdminWriteConditionMet) => void; + writeData: IUserData; + setWriteData: (value: IUserData) => void; + isButtonDisabled: boolean; + handleBtnOnClick: () => void; +} +function AdminWriteTemplate({ + menu, + setIsConditionMet, + writeData, + setWriteData, + isConditionMet, + isButtonDisabled, + handleBtnOnClick, +}: IProps): React.ReactElement { + return ( + + 관리자 페이지 + 글 올리기 + + 해시태그 + + + 등록하기 + + + ); } -export default Home; +export default AdminWriteTemplate; diff --git a/src/pages/AdminWrite/template/style.ts b/src/pages/AdminWrite/template/style.ts new file mode 100644 index 00000000..71401e5f --- /dev/null +++ b/src/pages/AdminWrite/template/style.ts @@ -0,0 +1,49 @@ +import { Button, Label } from 'components/atoms'; +import Styled, { css } from 'styled-components'; +import { palette, theme } from 'styled-tools'; + +export const PageLabel = Styled(Label)` + margin-top : 60px; + line-height: 1.5; + letter-spacing: -0.5px; + color : ${palette('grayscale', 7)}; + font-size: 16px; +`; + +export const Title = Styled(Label)` + ${theme('font.dp4')} + margin-top:10px; + margin-bottom : 110px; + color:${palette('grayscale', 7)}; +`; + +export const WriteLabel = Styled(Label)` + ${theme('font.subhead4')}; + width : 844px; + color: ${palette('grayscale', 9)}; + margin-bottom : 8px; +`; + +export const WriteButton = Styled(Button)<{ isButtonDisabled?: boolean }>` +/* 버튼 색이 안바뀜 */ + ${theme('font.subhead3')} + width: 406px; + height: 60px; + border-radius: 4px; + color : ${palette('grayscale', 0)}; + ${(props) => + props.isButtonDisabled + ? css` + background-color: ${palette('grayscale', 1)}; + ` + : css` + background-image: linear-gradient(to right, ${palette('primary', 3)}, ${palette('primary', 0)}); + `} + margin-bottom : 304px; +`; + +export const Wrapper = Styled.div` + display : flex; + flex-direction: column; + align-items: center; +`; diff --git a/src/pages/ChallengeEdit/index.tsx b/src/pages/ChallengeEdit/index.tsx index cb22cb8e..45911421 100644 --- a/src/pages/ChallengeEdit/index.tsx +++ b/src/pages/ChallengeEdit/index.tsx @@ -1,4 +1,4 @@ -import ChallengeEdit from 'components/molecules/ChallengeEditCard/index'; +import { ChallengeEditCard } from 'components/organisms'; import React from 'react'; import { RouteComponentProps } from 'react-router'; @@ -7,7 +7,7 @@ interface MatchParams { } function ChallengeWrite({ match }: RouteComponentProps): React.ReactElement { const { id } = match.params; - return ; + return ; } export default ChallengeWrite; diff --git a/src/pages/ChallengeList/index.tsx b/src/pages/ChallengeList/index.tsx index 85b599ce..80ba4bc1 100644 --- a/src/pages/ChallengeList/index.tsx +++ b/src/pages/ChallengeList/index.tsx @@ -1,11 +1,11 @@ import { ChallengeListData } from 'apis'; -import ChallengeHeader from 'components/molecules/ChallengeHeader'; -import ChallengeCard from 'components/organisms/ChallengeCard'; +import { ChallengeHeader } from 'components/molecules'; import React, { useCallback, useState } from 'react'; import { RouteComponentProps } from 'react-router'; import { useRecoilValue } from 'recoil'; import { userStatusState } from 'stores/user'; import { IChallengeData } from 'types/challenge.type'; +import ChallengeMiddle from './template'; interface MatchParams { generationNum: string; @@ -15,7 +15,6 @@ function ChallengeView({ match }: RouteComponentProps): React.React const { generationNum } = match.params; const [challengeList, setChallengeList] = useState(null); const userStatusData = useRecoilValue(userStatusState); - const [isClickedEntire, setIsClickedEntire] = useState(false); const getChallengeList = useCallback( async (token: string | null, offset: number, limit: number): Promise => { @@ -27,7 +26,7 @@ function ChallengeView({ match }: RouteComponentProps): React.React React.useEffect(() => { getChallengeList(userStatusData && userStatusData.token, 0, 10); - }, [getChallengeList, isClickedEntire, userStatusData]); + }, [getChallengeList, userStatusData]); return (
@@ -35,10 +34,12 @@ function ChallengeView({ match }: RouteComponentProps): React.React challengeList={challengeList} setChallengeList={setChallengeList} generationNum={generationNum} - isClickedEntire={isClickedEntire} - setIsClickedEntire={setIsClickedEntire} /> - +
); } diff --git a/src/components/organisms/ChallengeCard/index.tsx b/src/pages/ChallengeList/template/index.tsx similarity index 96% rename from src/components/organisms/ChallengeCard/index.tsx rename to src/pages/ChallengeList/template/index.tsx index ec5c7177..146da861 100644 --- a/src/components/organisms/ChallengeCard/index.tsx +++ b/src/pages/ChallengeList/template/index.tsx @@ -1,5 +1,5 @@ import { ChallengeListData } from 'apis'; -import { ChallengeDetailCard } from 'components/molecules'; +import { ChallengeDetailCard } from 'components/organisms'; import React, { useCallback, useEffect, useState } from 'react'; import { useRecoilValue } from 'recoil'; import { userStatusState } from 'stores/user'; diff --git a/src/components/organisms/ChallengeCard/style.ts b/src/pages/ChallengeList/template/style.ts similarity index 57% rename from src/components/organisms/ChallengeCard/style.ts rename to src/pages/ChallengeList/template/style.ts index df32e090..2e1497d3 100644 --- a/src/components/organisms/ChallengeCard/style.ts +++ b/src/pages/ChallengeList/template/style.ts @@ -3,9 +3,8 @@ import { theme } from 'styled-tools'; export const ChallengeCardWrapper = Styled.div` p{ - margin : 100px 0 100px 0; - width : 100%; - text-align :center; - ${theme('font.body3')}; + width : 100%; + text-align :center; + ${theme('font.body3')}; } `; diff --git a/src/pages/ChallengeRegister/index.tsx b/src/pages/ChallengeRegister/index.tsx index f0a63045..487598bb 100644 --- a/src/pages/ChallengeRegister/index.tsx +++ b/src/pages/ChallengeRegister/index.tsx @@ -1,12 +1,8 @@ -import Register from 'components/molecules/ChallengeDetailRegister'; import React from 'react'; +import ChallengeDetailRegister from './template'; const ChallengeRegister = () => { - return ( -
- -
- ); + return ; }; export default ChallengeRegister; diff --git a/src/pages/ChallengeRegister/template/index.tsx b/src/pages/ChallengeRegister/template/index.tsx new file mode 100644 index 00000000..a8d1fbf6 --- /dev/null +++ b/src/pages/ChallengeRegister/template/index.tsx @@ -0,0 +1,39 @@ +import { getRegistPeriod } from 'apis'; +import { ChallengeImg } from 'assets/images'; +import { RegisterHeader } from 'components/molecules'; +import { RegisterDetailCard } from 'components/organisms'; +import React, { useEffect, useState } from 'react'; +import { useRecoilState } from 'recoil'; +import { userState } from 'stores/user'; +import { IAdminChallengePeriod } from 'types/admin.type'; +import { Container, Header, RegisterImg } from './style'; + +function ChallengeRegister(): React.ReactElement { + const [userData, setUserData] = useRecoilState(userState); + const [periodData, setPeriodData] = useState(null); + + const getChallengePeriod = async () => { + const data = await getRegistPeriod(); + data && setPeriodData(data); + }; + useEffect(() => { + getChallengePeriod(); + }, []); + + return periodData ? ( + + +
+

챌린지 설명

+ +
+ + + + +
+ ) : ( +

챌린지 신청기간이 아닙니다

+ ); +} +export default ChallengeRegister; diff --git a/src/components/molecules/ChallengeDetailRegister/style.ts b/src/pages/ChallengeRegister/template/style.ts similarity index 55% rename from src/components/molecules/ChallengeDetailRegister/style.ts rename to src/pages/ChallengeRegister/template/style.ts index aee6914c..3cc82eb8 100644 --- a/src/components/molecules/ChallengeDetailRegister/style.ts +++ b/src/pages/ChallengeRegister/template/style.ts @@ -171,137 +171,3 @@ export const NoticeHeaderWrapper = Styled.div` float:right; } `; - -export const ConfirmModalWrapper = Styled.div` - position: fixed; - top:0; - right:0; - bottom:0; - left:0; - margin:auto; - border-radius: 16px; - background-color: ${palette('grayscale', 0)}; - width: 500px; - height: 613px; -`; - -export const CautionWrapper = Styled.div` - display: flex; - align-items: center; - justify-content: center; - margin-top: 50px; - -`; - -export const ConfirmDetail = Styled.div` - padding: 80px 80px 80px; - - h1{ - ${theme('font.h1')}; - color: ${palette('grayscale', 7)}; - } - h2{ - padding-top:10px; - padding-bottom:30px; - color: ${palette('grayscale', 4)}; - ${theme('font.body3')}; - } - img{ - margin-right: 8px; - } - h4{ - text-align: center; - color: ${palette('grayscale', 7)}; - ${theme('font.body2')}; - } - h5{ - padding-top:12px; - text-align: center; - color: ${palette('primary', 6)}; - ${theme('font.body2')}; - } -`; - -export const ModalButton = Styled.button` - display: flex; - flex-direction: row; - align-items: center; - justify-content: center; - border:none; - border-radius: 0px 0px 16px 16px; - background: linear-gradient(91.91deg, ${palette('primary', 3)} 7.34%, ${palette('primary', 0)} 90.35%); - width:500px; - height:64px; - - img{ - display:inline-block; - margin-right: 10px; - } - p{ - display:inline-block; - border:none; - border-radius: 0px 0px 16px 16px; - background: linear-gradient(91.91deg, ${palette('primary', 3)} 7.34%, ${palette('primary', 0)} 90.35%); - color: ${palette('grayscale', 0)}; - ${theme('font.subhead3')}; - } -`; - -export const DetailContent = Styled.div` - border-radius: 30px; - padding: 20px 40px 40px 40px; - height:192px; - text-align:left; - background-color: #f9f9f9; - - h3{ - display:inline-block; - padding-top:20px; - width: calc(100% - 150px); - text-align:left; - color: ${palette('grayscale', 7)}; - ${theme('font.body2')}; - } - p{ - display:inline-block; - text-align:left; - color: ${palette('grayscale', 7)}; - ${theme('font.subhead3')}; - } - `; - -export const RegisterSubmitWrapper = Styled.div` - position: fixed; - top:0; - right:0; - bottom:0; - left:0; - margin:auto; - border-width: 1px; - border-style: solid; - border-radius: 16px; - border-color:${palette('primary', 3)}; - background-color: ${palette('grayscale', 0)}; - width: 500px; - height: 273px; - - img{ - display:flex; - margin:auto; - margin-top:-40px; - } - h5{ - background: linear-gradient(to right, ${palette('primary', 3)}, ${palette('primary', 0)}); - -webkit-background-clip: text; - background-clip: text; - padding-top:20px; - padding-bottom:40px; - text-align: center; - -webkit-text-fill-color: transparent; - ${theme('font.dp4')}; - } - p{ - text-align: center; - ${theme('font.body3')}; - } -`; diff --git a/src/pages/ChallengeWrite/index.tsx b/src/pages/ChallengeWrite/index.tsx index 37cfd765..e4682d5f 100644 --- a/src/pages/ChallengeWrite/index.tsx +++ b/src/pages/ChallengeWrite/index.tsx @@ -1,4 +1,4 @@ -import ChallengeCard from 'components/molecules/ChallengeWriteCard'; +import { ChallengeWriteCard } from 'components/organisms'; import React from 'react'; const ChallengeWrite = () => { @@ -6,7 +6,7 @@ const ChallengeWrite = () => { return; }; - return ; + return ; }; export default ChallengeWrite; diff --git a/src/pages/Concert/index.tsx b/src/pages/Concert/index.tsx index 0e99fc7e..cfd70483 100644 --- a/src/pages/Concert/index.tsx +++ b/src/pages/Concert/index.tsx @@ -1,9 +1,7 @@ import { getConcertSearchData } from 'apis'; -import { ConcertTitle } from 'components/molecules'; -import { CategoryList, ConcertCardList, ConcertList, SearchForm } from 'components/organisms'; import React, { useEffect, useState } from 'react'; import { IConcert } from 'types/concert.type'; -import { ConcertWrapper } from './style'; +import ConcertTemplate from './template'; function Concert(): React.ReactElement { const [concertList, setConcertList] = useState(null); @@ -42,27 +40,18 @@ function Concert(): React.ReactElement { const concertData = concertList?.slice(3); return ( - - - - - - - + ); } diff --git a/src/pages/Concert/template/index.tsx b/src/pages/Concert/template/index.tsx index 238b58dd..c0e971ca 100644 --- a/src/pages/Concert/template/index.tsx +++ b/src/pages/Concert/template/index.tsx @@ -1,7 +1,57 @@ +import { ConcertTitle } from 'components/molecules'; +import { CategoryList, ConcertCardList, ConcertList, SearchForm } from 'components/organisms'; import React from 'react'; +import { IConcert } from 'types/concert.type'; +import { ConcertWrapper } from './style'; -function TConcert(): React.ReactElement { - return
ConcertTemplate
; +interface IProps { + reRenderCategory?: (interest: string) => void; + selectedCategory?: string; + categoryChange?: () => void; + reRenderKeyword?: (keyword: string) => void; + keywordChange?: () => void; + concertCardData: Array | undefined; + concertData: Array | undefined; + totalConcertNum: number; + currentPage: number; + setCurrentPage: (value: number) => void; } -export default TConcert; +function ConcertTemplate({ + reRenderCategory, + selectedCategory, + categoryChange, + reRenderKeyword, + keywordChange, + concertCardData, + concertData, + totalConcertNum, + currentPage, + setCurrentPage, +}: IProps): React.ReactElement { + return ( + + + + + + + + ); +} + +export default ConcertTemplate; diff --git a/src/pages/Concert/style.ts b/src/pages/Concert/template/style.ts similarity index 100% rename from src/pages/Concert/style.ts rename to src/pages/Concert/template/style.ts diff --git a/src/pages/ConcertDetail/index.tsx b/src/pages/ConcertDetail/index.tsx index 2ba1c4cf..023fc10c 100644 --- a/src/pages/ConcertDetail/index.tsx +++ b/src/pages/ConcertDetail/index.tsx @@ -6,14 +6,12 @@ import { postConcertLike, postConcertScrap, } from 'apis'; -import { DetailTitle, LoginModal } from 'components/molecules'; -import { CommentList, DetailContent } from 'components/organisms'; -import React, { useEffect, useState } from 'react'; +import React, { useCallback, useEffect, useState } from 'react'; import { RouteComponentProps } from 'react-router'; import { useRecoilValue } from 'recoil'; import { userStatusState } from 'stores/user'; -import { IConcert } from 'types/concert.type'; -import { ConcertDetailWrapper } from './style'; +import { IConcertComment, IUserConcert } from 'types/concert.type'; +import ConcertDetailTemplate from './template'; interface MatchParams { id: string; @@ -21,45 +19,46 @@ interface MatchParams { function ConcertDetail({ match }: RouteComponentProps): React.ReactElement { const { id } = match.params; - const [concert, setConcert] = useState(null); - const [commentList, setCommentList] = useState([]); + const [concert, setConcert] = useState(null); + const [commentList, setCommentList] = useState([]); const [likeNum, setLikeNum] = useState(0); const [scrapNum, setScrapNum] = useState(0); const userStatusData = useRecoilValue(userStatusState); const [isLoginModalOpen, setIsLoginModalOpen] = useState(false); const [isUserLike, setIsUserLike] = useState(false); const [isUserScrap, setIsUserScrap] = useState(false); - useEffect(() => { - const getConcertList = async () => { - if (userStatusData) { - const data = await getConcertUserData(userStatusData.token, id); - data && setConcert(data); - data && setCommentList(data.comments); - data && setLikeNum(data.likes); - data && setScrapNum(data.scrapNum); - data && setIsUserLike(data.isLike); - data && setIsUserScrap(data.isScrap); - } else { - const data = await getConcertData(id); - data && setConcert(data); - data && setCommentList(data.comments); - data && setLikeNum(data.likes); - data && setScrapNum(data.scrapNum); - } - }; - getConcertList(); - }, [commentList, likeNum, scrapNum, id, userStatusData]); + const [isRerender, setIsRerender] = useState(false); - const reLoadComment = (newComment: any) => { - setCommentList(commentList?.concat(newComment)); - }; + const getConcertContent = useCallback(async () => { + if (userStatusData) { + const data = await getConcertUserData(userStatusData.token, id); + data && setConcert(data); + data && setCommentList(data.comments); + data && setLikeNum(data.likes); + data && setScrapNum(data.scrapNum); + data && setIsUserLike(data.isLike); + data && setIsUserScrap(data.isScrap); + } else { + const data = await getConcertData(id); + data && setConcert(data); + data && setCommentList(data.comments); + data && setLikeNum(data.likes); + data && setScrapNum(data.scrapNum); + } + }, [id, userStatusData]); + + useEffect(() => { + getConcertContent(); + }, [isRerender, getConcertContent]); const onLike = async () => { if (userStatusData) { const postLike = await postConcertLike(userStatusData.token, id); if (postLike === true) { await deleteConcertLike(userStatusData.token, id); + setIsRerender(!isRerender); } + setIsRerender(!isRerender); } else { setIsLoginModalOpen(true); } @@ -69,40 +68,29 @@ function ConcertDetail({ match }: RouteComponentProps): React.React const postScrap = await postConcertScrap(userStatusData.token, id); if (postScrap === true) { await deleteConcertScrap(userStatusData.token, id); + setIsRerender(!isRerender); } + setIsRerender(!isRerender); } else { setIsLoginModalOpen(true); } }; return ( - - {concert && ( - - )} - {concert && ( - - )} - - - + ); } diff --git a/src/pages/ConcertDetail/template/index.tsx b/src/pages/ConcertDetail/template/index.tsx index ad1b2c05..bda8e084 100644 --- a/src/pages/ConcertDetail/template/index.tsx +++ b/src/pages/ConcertDetail/template/index.tsx @@ -1,7 +1,70 @@ +import { DetailTitle, LoginModal } from 'components/molecules'; +import { CommentList, DetailContent } from 'components/organisms'; import React from 'react'; - -function TConcertDetail(): React.ReactElement { - return
ConcertDetailTemplate
; +import { IConcertComment, IUserConcert } from 'types/concert.type'; +import { ConcertDetailWrapper } from './style'; +interface IProps { + concert: IUserConcert | null; + likeNum?: number; + scrapNum?: number; + onLike?: () => void; + onScrap?: () => void; + isUserLike?: boolean; + isUserScrap?: boolean; + commentList: Array; + isRerender: boolean; + setIsRerender: (value: boolean) => void; + isLoginModalOpen: boolean; + setIsLoginModalOpen: (value: boolean) => void; +} +function ConcertDetailTemplate({ + concert, + likeNum, + scrapNum, + onLike, + onScrap, + isUserLike, + isUserScrap, + commentList, + isRerender, + setIsRerender, + isLoginModalOpen, + setIsLoginModalOpen, +}: IProps): React.ReactElement { + return ( + + {concert && ( + + )} + {concert && ( + + )} + + + + ); } -export default TConcertDetail; +export default ConcertDetailTemplate; diff --git a/src/pages/ConcertDetail/style.ts b/src/pages/ConcertDetail/template/style.ts similarity index 100% rename from src/pages/ConcertDetail/style.ts rename to src/pages/ConcertDetail/template/style.ts diff --git a/src/pages/Home/index.tsx b/src/pages/Home/index.tsx index 9efcf9e6..c026485a 100644 --- a/src/pages/Home/index.tsx +++ b/src/pages/Home/index.tsx @@ -1,4 +1,3 @@ -import { keyframes } from '@emotion/react'; import { getGeneration } from 'apis'; import { CommunicationKingFillIcon, @@ -20,12 +19,47 @@ import { UsefulLearnMyselfFillIcon, WelcomeToO2FillIcon, } from 'assets/images'; -import { Button } from 'components/atoms'; -import { BadgeCard } from 'components/molecules'; +import { BadgeCard, SpeakerExpCard } from 'components/molecules'; import React, { useEffect, useState } from 'react'; -import Reveal from 'react-awesome-reveal'; import { Link } from 'react-router-dom'; -import Styled from 'styled-components'; +import { keyframes } from 'styled-components'; +import { + BadgeWrapper, + ChallengeBtn, + ChallengeCard, + ChallengeCardWrapper, + ChallengeWrapper, + ConcertContent, + ConcertExpContainer1, + ConcertExpContainer2, + ConcertExpType, + ConcertImage1, + ConcertImage2, + ConcertTitle, + ConcertWrapper, + ConcertWrapper1, + ConcertWrapper2, + HomeContainer, + LinkBtn, + LinkCardWrapper, + LinkExp, + LinkTitle, + LinkWrapper, + MiddleExp, + MiddleSubTitle, + MiddleTitle, + O2BadgeSubTitle, + O2BadgeTitle, + O2BadgeWrapper, + O2SpeakerCardWrapper, + O2SpeakerSubTitle, + O2SpeakerTitle, + O2SpeakerWrapper, + O2Title, + TopExp, + TopSubTitle, + TopWrapper, +} from './style'; const moveUp = keyframes` from { @@ -50,494 +84,219 @@ function Home(): React.ReactElement { }, []); return ( - - -
-

O2

-

- 함께 성장하는 공간,
- 창업가들이 마시는 산소 -

-

답답한 창업 여정에 시원한 산소 한 모금

- - - -
-
-
- -

Learn Myself

-

나에게 배우다, 나를 배우다.

-

- 오늘의 잘한 점과 못한 점, 배운 점을 기록해요. -
- 배운 점을 적용하며 더 성장한 내일의 나를 만들어요. -

-
- -
    - - - - -
-
-
-
- -

Share Together

-

경험을 나누다, 함께 성장하다.

-

- 누구나 O2 Speaker가 될 수 있어요. -
- O2 People 앞에서 당신의 이야기를 나눠주세요. -

-
-
- -
- -

Share Together 인기글

-

- 내가 힘들 때 버틸 수 있었던
- 3가지 -

-

- 창업을 하다보면 정말 생각하지 못했던 어려운 일들이
- 많이 일어나는건 누구나 알고계실거라 생각합니다.
- 중간에 포기하고 싶어지는 순간에 앵엘님의 + + + O2 + + 함께 성장하는 공간,
+ 창업가들이 마시는 산소 +
+ 답답한 창업 여정에 시원한 산소 한 모금 + + 챌린지 보러가기 + +
+ + Learn Myself + 나에게 배우다, 나를 배우다. + + 오늘의 잘한 점과 못한 점, 배운 점을 기록해요. +
+ 배운 점을 적용하며 더 성장한 내일의 나를 만들어요. +
+ + + + + + + {/* */} +
+ + Share Together + 경험을 나누다, 함께 성장하다. + + 누구나 O2 Speaker가 될 수 있어요. +
+ O2 People 앞에서 당신의 이야기를 나눠주세요. +
+ + + + Share Together 인기글 + + 내가 힘들 때 버틸 수 있었던
+ 3가지 +
+ + 창업을 하다보면 정말 생각하지 못했던 어려운 일들이
+ 많이 일어나는건 누구나 알고계실거라 생각합니다.
+ 중간에 포기하고 싶어지는 순간에 앵엘님의 +
+ [내가 힘들 때 버틸 수 있었던 3가지] 강연으로 나만의
+ 버팀목도 한번 만들어보세요. +
+
+
+ + + Share Together 인기글 + + CEO라는 꿈.
+ 정말 나를 위한 유일한 길일까? +
+ + 여러분은 자신의 꿈에 얼마나 큰 확신을 가지고있나요?
+ 아마 꿈을 향해 나아가면서도 끊임없이 ‘내가 잘 하고 있는 것인가?‘,
+ ‘이게 정말 나를 위한 길인가?’ 이런 생각이 드실거라 생각합니다.
+ 깡토님의 [CEO라는 꿈. 정말 나를 위한 유일한 길일까?] 강연에서는 불안 +
+ 하기만 CEO라는 꿈을 어떻게 이룰 수 있었는지,
+ 깡토님의 실제 스토리를 여러분들께 들려드립니다. +
+
+ +
+
+ + To Be an O2 Speaker + 뱃지를 모아 O2 Speaker가 되어보세요! + {/* */} + + + + + + {/* */} + + + O2 Badge + 열심히 활동하면 멋진 오투의 뱃지들을 받을 수 있어요. + {/* */} + + + 첫 회원가입을 했을 때
+ 받을 수 있는 뱃지예요. + + } + /> + + 타인의 Learn Myself를 처음 스크랩
- [내가 힘들 때 버틸 수 있었던 3가지] 강연으로 나만의
- 버팀목도 한번 만들어보세요. -

-
-
-
-
-
- -

Share Together 인기글

-

- CEO라는 꿈.
- 정말 나를 위한 유일한 길일까? -

-

- 여러분은 자신의 꿈에 얼마나 큰 확신을 가지고있나요?
- 아마 꿈을 향해 나아가면서도 끊임없이 ‘내가 잘 하고 있는 것인가?‘,
- ‘이게 정말 나를 위한 길인가?’ 이런 생각이 드실거라 생각합니다.
- 깡토님의 [CEO라는 꿈. 정말 나를 위한 유일한 길일까?] 강연에서는 불안 -
- 하기만 CEO라는 꿈을 어떻게 이룰 수 있었는지,
- 깡토님의 실제 스토리를 여러분들께 들려드립니다. -

-
-
- -
-
-
- -

To Be an O2 Speaker

-

뱃지를 모아 O2 Speaker가 되어보세요!

-
- -
    -
  • - -

    - 챌린지 개수를 주당
    - 3개 이상으로 설정 -

    -
  • -
  • - -

    - 런마쎌을 80%이상 작성 후
    - 챌린지뱃지를 획득 -

    -
  • -
  • - -

    - 챌린지뱃지 3개 + 활동뱃지 12개
    - 얻을 시 연사가능 -

    -
  • -
-
-
-
- -

O2 Badge

-

열심히 활동하면 멋진 오투의 뱃지들을 받을 수 있어요.

-
- -
    - - 첫 회원가입을 했을 때
    - 받을 수 있는 뱃지예요. - - } - /> - - 타인의 Learn Myself를 처음 스크랩 -
    - 했을 때 받을 수 있는 뱃지에요. - - } - /> - - 타인의 Learn Myself에 댓글 5개를
    - 작성할 시 받을 수 있는 뱃지에요. - - } - /> - - 타인의 글의 좋아요를 처음
    - 눌렀을 때 받을 수 있는 뱃지에요. - - } - /> - - 타인의 글에 댓글을 처음
    - 달았을 때 받을 수 있는 뱃지에요. - - } - /> - - 오투에 3일 연속 로그인
    - 했을 때 받을 수 있는 뱃지에요. - - } - /> - - Learn Myself 첫 작성 시
    - 받을 수 있는 뱃지에요. - - } - /> - - 타인의 댓글의 답글을 처음 달았을 때
    - 받을 수 있는 뱃지에요. - - } - /> -
-
-
-
-
-

+ 했을 때 받을 수 있는 뱃지에요. + + } + /> + + 타인의 Learn Myself에 댓글 5개를
+ 작성할 시 받을 수 있는 뱃지에요. + + } + /> + + 타인의 글의 좋아요를 처음
+ 눌렀을 때 받을 수 있는 뱃지에요. + + } + /> + + 타인의 글에 댓글을 처음
+ 달았을 때 받을 수 있는 뱃지에요. + + } + /> + + 오투에 3일 연속 로그인
+ 했을 때 받을 수 있는 뱃지에요. + + } + /> + + Learn Myself 첫 작성 시
+ 받을 수 있는 뱃지에요. + + } + /> + + 타인의 댓글의 답글을 처음 달았을 때
+ 받을 수 있는 뱃지에요. + + } + /> + + {/* */} + + + + Learn Myself
Register -

-

+ + Learn Myself에
참여해 보세요! -

+ - - - + More -
-
-

Learn Myself

-

+ + + Learn Myself + 나만의
챌린지를 시작해 보세요 -

- - - - - -
-
-

Share Together

-

+ + + More + + + + Share Together + O2 People의 이야기를
들어보세요! -

- - - - - -
-
-
+ + + More + + + + ); } -const JoinWrap = Styled.div` - display : flex; - flex-direction : column; - align-items : center; - background-image: url('${LandingBackImg}'); - background-repeat: no-repeat; - background-size: cover; - background-position: center; - min-height: 6114px; - overflow-x: hidden; - img{ - margin : 0; - padding : 0; - } - /* @keyframes moveUp { - from { - transform: translateY(8%); - opacity: 0; - } - to { - transform: translateY(0); - opacity: 1; - } - } */ - .linkTo{ - width : 100%; - padding-top : 208px; - margin-top : 150px; - padding-bottom : 187px; - background-color : #2f3438; - display : flex; - justify-content : center; - align-items : center; - gap : 110px; - &__container--card{ - display : flex; - flex-direction : column; - } - &__title{ - color : #ffffff; - height : 68px; - } - &__exp{ - color : #dfdfdf; - margin : 31px 0; - } - &__button{ - width: 200px; - height: 60px; - background-color : #36c8f5; - color : #ffffff; - } - } - .o2badge{ - padding-top : 150px; - display : flex; - flex-direction: column; - align-items : center; - &__title{ - color : #0d0d0d; - margin-bottom : 20px; - } - &__subtitle{ - color : #6f6f6f; - margin-bottom : 150px; - } - &__container--badge{ - display : grid; - grid-template-columns: repeat(2, 1fr); - grid-column-gap: 468px; - grid-row-gap: 100px; - } - } - .o2speaker{ - width : 100vw; - background-color : #2f3438; - display : flex; - flex-direction : column; - align-items : center; - padding : 120px 0; - &__title{ - color : #ffffff; - } - &__subtitle{ - color : #a5a5a5; - margin-top : 20px; - margin-bottom : 138px; - } - &__exp{ - color : #ffffff; - text-align: center; - margin-top : 48px; - } - &__container{ - &--outer{ - width : 1100px; - display : flex; - flex-direction : row; - justify-content : space-between; - } - &--inner{ - display : flex; - flex-direction : column; - align-items : center; - } - } - &__image--badge{ - width: 260px; - height: 260px; - } - } - .top{ - padding-top : 178px; - width : 1109px; - /* animation-name: moveUp; - animation-duration: 1.5s; */ - &__title{ - &--O2{ - font-size: 90px; - font-weight: bold; - line-height: 0.62; - letter-spacing: -0.5px; - font-family: HomepageBaukasten; - margin-bottom : 50px; - color : #0d0d0d; - } - &--subtitle{ - color : #0d0d0d; - } - } - &__exp{ - margin-top : 20px; - margin-bottom : 30px; - color : #3d3d3d; - } - &__button{ - width : 164px; - height : 40px; - color : #ffffff; - background-color : #3d3d3d; - border-radius: 50px; - } - } - .middle{ - &__title{ - &--title{ - color : #0d0d0d; - } - &--subtitle{ - color : #6f6f6f; - margin-top : 20px; - margin-bottom : 40px; - } - } - &__exp{ - color : #8b8b8b; - } - } - .learnMyself{ - padding-top : 435px; - width : 1109px; - &__container--card{ - margin-top :80px; - display : flex; - width : 1109px; - justify-content : space-between; - } - &__img--card{ - width : 254px; - height : 259px; - width: 254px; - height: 259px; - } - } - .shareTogether{ - width : 1109px; - padding-top : 270px; - padding-bottom : 151px; - &__title{ - color : #3d3d3d; - margin-top : 10px; - } - &__container{ - &--photo1{ - margin-top : 90px; - display : flex; - flex-direction : row; - } - &--photo2{ - margin-top : 153px; - display : flex; - flex-direction : row; - justify-content : space-between; - } - &--exp1{ - display : flex; - flex-direction: column; - align-items : flex-start; - padding-top : 58px; - } - &--exp2{ - display : flex; - flex-direction: column; - align-items : flex-start; - padding-top : 141px; - } - } - &__image1{ - width : 672px; - height : 449px; - margin-right : 93px; - } - &__image2{ - width: 464px; - height: 745px; - } - &__exp{ - &--type{ - color : #8b8b8b; - } - } - &__content{ - margin-top : 32px; - font-family: AppleSDGothicNeo; - font-size: 14px; - font-weight: normal; - font-stretch: normal; - font-style: normal; - line-height: 1.79; - letter-spacing: -0.5px; - color : #555555; - } - } - -`; - export default Home; diff --git a/src/pages/Home/style.ts b/src/pages/Home/style.ts new file mode 100644 index 00000000..ddae30e8 --- /dev/null +++ b/src/pages/Home/style.ts @@ -0,0 +1,252 @@ +import { Button } from 'components/atoms'; +import Styled, { css } from 'styled-components'; +import { palette, theme } from 'styled-tools'; + +export const TopWrapper = Styled.div` + padding-top : 178px; + width : 1109px; +`; + +export const HomeContainer = Styled.div<{ image: string }>` + display : flex; + flex-direction : column; + align-items : center; + ${(props) => + css` + background-image: url('${props.image}'); + `} + background-repeat: no-repeat; + background-size: cover; + background-position: center; + min-height: 6114px; + overflow-x: hidden; + img{ + margin : 0; + padding : 0; + } +`; + +export const O2Title = Styled.h1` + font-size: 90px; + font-weight: bold; + line-height: 0.62; + letter-spacing: -0.5px; + font-family: HomepageBaukasten; + margin-bottom : 50px; + color : ${palette('grayscale', 9)}; +`; + +export const TopSubTitle = Styled.h2` + ${theme('font.dp2')}; + color : ${palette('grayscale', 9)}; +`; + +export const TopExp = Styled.p` + ${theme('font.body4')}; + margin-top : 20px; + margin-bottom : 30px; + color : ${palette('grayscale', 7)}; +`; + +export const ChallengeBtn = Styled(Button)` + ${theme('font.subhead2')}; + width : 164px; + height : 40px; + color : ${palette('grayscale', 0)}; + background-color : ${palette('grayscale', 7)}; + border-radius: 50px; +`; + +export const ChallengeWrapper = Styled.div` + padding-top : 435px; + width : 1109px; +`; + +export const MiddleTitle = Styled.h2` + ${theme('font.dp1_eng')}; + color : ${palette('grayscale', 9)}; +`; + +export const MiddleSubTitle = Styled.h3` + ${theme('font.h1')}; + color : ${palette('grayscale', 5)}; + margin-top : 20px; + margin-bottom : 40px; +`; + +export const MiddleExp = Styled.p` + ${theme('font.body4')}; + color : ${palette('grayscale', 4)}; +`; + +export const ChallengeCardWrapper = Styled.ul` + margin-top :80px; + display : flex; + width : 1109px; + justify-content : space-between; +`; + +export const ChallengeCard = Styled.img` + width : 254px; + height : 259px; + width: 254px; + height: 259px; +`; + +export const ConcertWrapper = Styled.div` + width : 1109px; + padding-top : 270px; + padding-bottom : 151px; +`; + +export const ConcertWrapper1 = Styled.div` + margin-top : 90px; + display : flex; + flex-direction : row; +`; + +export const ConcertWrapper2 = Styled.div` + margin-top : 153px; + display : flex; + flex-direction : row; + justify-content : space-between; +`; + +export const ConcertImage1 = Styled.img` + width : 672px; + height : 449px; + margin-right : 93px; +`; + +export const ConcertImage2 = Styled.img` + width: 464px; + height: 745px; +`; + +export const ConcertExpContainer1 = Styled.div` + display : flex; + flex-direction: column; + align-items : flex-start; + padding-top : 58px; +`; + +export const ConcertExpContainer2 = Styled.div` + display : flex; + flex-direction: column; + align-items : flex-start; + padding-top : 141px; +`; + +export const ConcertExpType = Styled.p` + ${theme('font.body3')}; + color : ${palette('grayscale', 4)}; +`; + +export const ConcertTitle = Styled.h1` + ${theme('font.h1')}; + color : ${palette('grayscale', 7)}; + margin-top : 10px; +`; + +export const ConcertContent = Styled.p` + margin-top : 32px; + font-family: AppleSDGothicNeo; + font-size: 14px; + font-weight: normal; + font-stretch: normal; + font-style: normal; + line-height: 1.79; + letter-spacing: -0.5px; + color : ${palette('grayscale', 6)}; +`; + +export const O2SpeakerWrapper = Styled.div` + width : 100vw; + background-color : #2f3438; + display : flex; + flex-direction : column; + align-items : center; + padding : 120px 0; +`; + +export const O2SpeakerTitle = Styled.h1` + ${theme('font.dp1_eng')}; + color : ${palette('grayscale', 0)}; +`; + +export const O2SpeakerSubTitle = Styled.h2` + ${theme('font.subhead4')}; + color : ${palette('grayscale', 3)}; + margin-top : 20px; + margin-bottom : 138px; +`; + +export const O2SpeakerCardWrapper = Styled.ul` + width : 1100px; + display : flex; + flex-direction : row; + justify-content : space-between; +`; + +export const O2BadgeWrapper = Styled.div` + padding-top : 150px; + display : flex; + flex-direction: column; + align-items : center; +`; + +export const O2BadgeTitle = Styled.h1` + ${theme('font.dp1_eng')}; + color : ${palette('grayscale', 9)}; + margin-bottom : 20px; +`; + +export const O2BadgeSubTitle = Styled.h2` + ${theme('font.subhead4')}; + color : ${palette('grayscale', 5)}; + margin-bottom : 150px; +`; + +export const BadgeWrapper = Styled.ul` + display : grid; + grid-template-columns: repeat(2, 1fr); + grid-column-gap: 468px; + grid-row-gap: 100px; +`; + +export const LinkWrapper = Styled.div` + width : 100%; + padding-top : 208px; + margin-top : 150px; + padding-bottom : 187px; + background-color : #2f3438; + display : flex; + justify-content : center; + align-items : center; + gap : 110px; +`; + +export const LinkCardWrapper = Styled.div` + display : flex; + flex-direction : column; +`; + +export const LinkTitle = Styled.h1` + ${theme('font.h1_eng')}; + color : ${palette('grayscale', 0)}; + height : 68px; +`; + +export const LinkExp = Styled.p` + ${theme('font.body4')}; + color : ${palette('grayscale', 1)}; + margin : 31px 0; +`; + +export const LinkBtn = Styled(Button)` + ${theme('font.subhead4_eng')}; + width: 200px; + height: 60px; + background-color : ${palette('primary', 3)}; + color : ${palette('grayscale', 0)}; +`; diff --git a/src/pages/Join/index.tsx b/src/pages/Join/index.tsx index ba8813aa..43534ada 100644 --- a/src/pages/Join/index.tsx +++ b/src/pages/Join/index.tsx @@ -1,10 +1,116 @@ -import { Join as CJoin } from 'components/organisms'; -import React from 'react'; +import { postJoin } from 'apis'; +import React, { useEffect, useState } from 'react'; +import { useHistory } from 'react-router-dom'; +import JoinTemplate from './template'; function Join(): React.ReactElement { + const history = useHistory(); + const [isJoinButtonDisabled, setIsJoinButtonDisabled] = useState(true); + const [isInterestModalOpen, setIsInterestModalOpen] = useState(false); + const [isConditionMet, setIsConditionMet] = useState({ + email: false, + password: false, + passwordCheck: false, + nickname: false, + interest: false, + policyMust: false, + gender: false, + }); + const [userData, setUserData] = useState({ + email: '', + password: '', + passwordCheck: '', + nickname: '', + gender: -1, + interest: [''], + marpolicy: false, + policyMust: false, + }); + const [gender, setGender] = useState('선택안함'); + const [selectedInterest, setSelectedInterest] = useState([]); + const handleInterestOnClick = (interest: string) => { + if (selectedInterest.length === 0) { + setSelectedInterest([interest]); + } + if (selectedInterest.length < 5) { + if (!selectedInterest.includes(interest)) { + setSelectedInterest([...selectedInterest, interest]); + } else { + setSelectedInterest(selectedInterest.filter((v) => v !== interest)); + } + } else { + if (selectedInterest.includes(interest)) { + setSelectedInterest(selectedInterest.filter((v) => v !== interest)); + } + } + }; + const modalBtnHandler = async () => { + //여기서 api호출!! + const postData = { + email: userData.email, + password: userData.password, + nickname: userData.nickname, + interest: userData.interest, + gender: userData.gender, + marpolicy: userData.marpolicy, + }; + const getData = await postJoin(postData); + if (getData) { + history.push('/'); + } + }; + const joinBtnHandler = () => { + setIsInterestModalOpen(true); + }; + const changeGenderStringtoNum = (gender: string) => { + switch (gender) { + case '남성': + return 0; + case '여성': + return 1; + default: + return 2; + } + }; + useEffect(() => { + setUserData({ ...userData, interest: selectedInterest }); + }, [selectedInterest]); + useEffect(() => { + setUserData({ ...userData, gender: changeGenderStringtoNum(gender) }); + }, [gender]); + + useEffect(() => { + if ( + isConditionMet.email && + isConditionMet.password && + isConditionMet.passwordCheck && + isConditionMet.nickname && + isConditionMet.gender && + isConditionMet.policyMust + ) { + setIsJoinButtonDisabled(false); + } else { + setIsJoinButtonDisabled(true); + } + }, [isConditionMet]); + return ( <> - + ); } diff --git a/src/pages/Join/template/index.tsx b/src/pages/Join/template/index.tsx index 4929a371..cbc6783b 100644 --- a/src/pages/Join/template/index.tsx +++ b/src/pages/Join/template/index.tsx @@ -1,7 +1,71 @@ +import { DropDown } from 'components/molecules'; +import { InterestModal, JoinCheck, JoinForm } from 'components/organisms'; import React from 'react'; +import { IJoinConditionMet, IJoinData } from 'types/join.type'; +import { JoinButton, JoinLabel, JoinWrap, SubTitle } from './style'; -function Join(): React.ReactElement { - return
Join
; +interface IProps { + isConditionMet: IJoinConditionMet; + setIsConditionMet: (value: IJoinConditionMet) => void; + userData: IJoinData; + setUserData: (value: IJoinData) => void; + isJoinButtonDisabled: boolean; + joinBtnHandler: () => void; + isInterestModalOpen: boolean; + setIsInterestModalOpen: (value: boolean) => void; + handleInterestOnClick: (interest: string) => void; + selectedInterest: string[]; + modalBtnHandler: () => Promise; + gender: string; + setGender: (gender: string) => void; } -export default Join; +function JoinTemplate({ + isConditionMet, + setIsConditionMet, + userData, + setUserData, + isJoinButtonDisabled, + joinBtnHandler, + isInterestModalOpen, + setIsInterestModalOpen, + handleInterestOnClick, + selectedInterest, + modalBtnHandler, + gender, + setGender, +}: IProps): React.ReactElement { + return ( + + 회원가입 + + 성별 + + 약관동의 + + + 가입 완료 + + + + ); +} + +export default JoinTemplate; diff --git a/src/pages/Join/template/style.ts b/src/pages/Join/template/style.ts new file mode 100644 index 00000000..20ccca9a --- /dev/null +++ b/src/pages/Join/template/style.ts @@ -0,0 +1,42 @@ +import { Button, Label } from 'components/atoms'; +import Styled, { css } from 'styled-components'; +import { palette, theme } from 'styled-tools'; + +export const JoinLabel = Styled(Label)` + font-size: 40px; + font-weight: bold; + margin-bottom : 20px; +`; + +export const SubTitle = Styled.div` + ${theme('font.subhead4')} + margin-top : 40px; + margin-bottom : 8px; + width : 406px; +`; + +export const JoinButton = Styled(Button)<{ isButtonDisabled: boolean }>` + width: 406px; + height: 60px; + border-radius: 4px; + font-size : 16px; + font-weight : bold; + color : ${palette('grayscale', 0)}; + margin-top : 60px; + ${(props) => + props.isButtonDisabled + ? css` + background-color: ${palette('grayscale', 1)}; + ` + : css` + background-image: linear-gradient(to right, ${palette('primary', 3)}, ${palette('primary', 0)}); + `}; +`; + +export const JoinWrap = Styled.div` + display : flex; + flex-direction : column; + align-items : center; + margin-top : 100px; + margin-bottom : 250px; +`; diff --git a/src/pages/Login/index.tsx b/src/pages/Login/index.tsx index fdf97a1b..67cbb855 100644 --- a/src/pages/Login/index.tsx +++ b/src/pages/Login/index.tsx @@ -1,8 +1,95 @@ -import { Login as CLogin } from 'components/organisms'; -import React from 'react'; +import { getUserData, postLogin } from 'apis'; +import React, { useEffect, useState } from 'react'; +import { useHistory } from 'react-router-dom'; +import { useRecoilState } from 'recoil'; +import { userState, userStatusState } from 'stores/user'; +import LoginTemplate from './template'; function Login(): React.ReactElement { - return ; + const history = useHistory(); + const [loginData, setLoginData] = useState({ + // 값 저장 + email: '', + password: '', + }); + const [userStatusData, setUserStatusData] = useRecoilState(userStatusState); + const [userData, setUserData] = useRecoilState(userState); + const [isConditionMet, setIsConditionMet] = useState({ + email: true, + pwd: true, + }); + + const idInputChange = (value: string) => { + if (typeof value === 'string') setLoginData({ ...loginData, email: value }); + }; + const pwdInputChange = (value: string) => { + if (typeof value === 'string') setLoginData({ ...loginData, password: value }); + }; + + const handleLoginBtn = async () => { + const token = await getUserStatusData(); + const isSuccess = await getUserDetailData(token); + isSuccess && history.push('/'); + }; + useEffect(() => { + if (userStatusData && userData) { + alert('이미 로그인이 되어있습니다. '); + history.push('/'); + } + }, []); + + const getUserStatusData = async () => { + const data = await postLogin(loginData); + if (data) { + if (data.status === 200) { + setUserStatusData({ + token: data.token, + userType: data.data.userState, + totalGeneration: data.data.totalGeneration, + registGeneration: data.data.registGeneration, + progressGeneration: data.data.progressGeneration ? data.data.progressGeneration : 0, + }); + return data.token; + } else { + if (data.message === '아이디가 존재하지 않습니다') { + setIsConditionMet({ email: false, pwd: true }); + } else if (data.message === '비밀번호가 틀렸습니다') { + setIsConditionMet({ email: true, pwd: false }); + } + } + } else { + alert('네트워크가 좋지 않습니다'); + } + return ''; + }; + const getUserDetailData = async (token: string): Promise => { + if (token) { + const data = await getUserData(token); + if (data !== undefined) { + setUserData({ + interest: data.interest, + marpolicy: data.marpolicy, + img: data.img, + _id: data._id, + email: data.email, + nickname: data.nickname, + gender: data.gender, + }); + return true; + } else { + alert('네트워크가 좋지 않습니다'); + } + } + return false; + }; + return ( + + ); } export default Login; diff --git a/src/pages/Login/template/index.tsx b/src/pages/Login/template/index.tsx index f08922a7..c5c60116 100644 --- a/src/pages/Login/template/index.tsx +++ b/src/pages/Login/template/index.tsx @@ -1,7 +1,36 @@ +import { LineIcon } from 'assets/images'; +import { Link } from 'components/atoms'; +import { LoginForm } from 'components/organisms'; import React from 'react'; +import { ButtonWrapper, FindPwdBtn, JoinBtn, Line, LoginBtn, LoginContainer, LoginLabel } from './style'; -function Login(): React.ReactElement { - return
Login
; +interface IProps { + handleLoginBtn: () => Promise; + idInputChange: (value: string) => void; + pwdInputChange: (value: string) => void; + isConditionMet: { + email: boolean; + pwd: boolean; + }; } -export default Login; +function LoginTemplate({ handleLoginBtn, idInputChange, pwdInputChange, isConditionMet }: IProps): React.ReactElement { + return ( + + 로그인 + + 로그인 + + + 비밀번호 찾기 + + + + 회원가입 + + + + ); +} + +export default LoginTemplate; diff --git a/src/components/organisms/Login/style.ts b/src/pages/Login/template/style.ts similarity index 65% rename from src/components/organisms/Login/style.ts rename to src/pages/Login/template/style.ts index 119595e6..40d4dc8c 100644 --- a/src/components/organisms/Login/style.ts +++ b/src/pages/Login/template/style.ts @@ -1,17 +1,29 @@ import { Button, Label } from 'components/atoms'; import Styled from 'styled-components'; +import { palette } from 'styled-tools'; export const Line = Styled.img` -background-color : #8b8b8b; +background-color : ${palette('grayscale', 4)}; width : 1px; height : 16px; object-fit : contain; `; +export const LoginBtn = Styled(Button)` + margin-top : 14px; + border-radius: 4px; + background-image: linear-gradient(to right, ${palette('primary', 3)},${palette('primary', 0)} ); + width: 406px; + height: 60px; + color : ${palette('grayscale', 0)}; + font-size : 16px; + font-weight : bold; +`; + export const JoinBtn = Styled(Button)` margin-left : 15px; line-height : 1.5; -color : #8b8b8b; +color : ${palette('grayscale', 4)}; font-family: AppleSDGothicNeo; font-size : 16px; font-weight : bold; @@ -20,7 +32,7 @@ font-weight : bold; export const FindPwdBtn = Styled(Button)` margin-right : 15px; line-height : 1.5; -color : #8b8b8b; +color : ${palette('grayscale', 4)}; font-family: AppleSDGothicNeo; font-size : 16px; `; diff --git a/src/pages/MyChallengeList/index.tsx b/src/pages/MyChallengeList/index.tsx index f711744c..a32938ee 100644 --- a/src/pages/MyChallengeList/index.tsx +++ b/src/pages/MyChallengeList/index.tsx @@ -1,5 +1,5 @@ import { getUserChallengeList } from 'apis'; -import { ChallengeDetailCard } from 'components/molecules'; +import { ChallengeDetailCard } from 'components/organisms'; import React, { useCallback, useEffect, useState } from 'react'; import { useRecoilValue } from 'recoil'; import { userStatusState } from 'stores/user'; diff --git a/src/pages/MyPage/index.tsx b/src/pages/MyPage/index.tsx index 04e0fb0b..b2d45b65 100644 --- a/src/pages/MyPage/index.tsx +++ b/src/pages/MyPage/index.tsx @@ -9,16 +9,7 @@ import { getUserCommentList, } from 'apis'; import { Logo } from 'assets/images'; -import { Modal } from 'components/atoms'; -import { - ChallengeCard, - ChallengeModalComment, - DeleteModal, - MyPageConcertCard, - MyPageSection, -} from 'components/molecules'; -import { MyCommentList, MyPageHeader } from 'components/organisms'; -import dayjs from 'dayjs'; +import { ChallengeCard, MyPageConcertCard } from 'components/molecules'; import React, { useCallback, useEffect, useState } from 'react'; import { useRecoilValue } from 'recoil'; import { userState, userStatusState } from 'stores/user'; @@ -26,24 +17,7 @@ import { IChallenge, IChallengeData } from 'types/challenge.type'; import { IConcert } from 'types/concert.type'; import { IMyPageHeader, IMyScrappedChallenge, IMyScrappedConcert, IMyUserCommentResponse } from 'types/myPage.type'; import { changeDateFormat } from 'utils'; -import { - Body, - Bottom, - ChallengeModalWrapper, - CloseButton, - CommentWrapper, - Header, - ModalUserImg, - ModalUserInfo, - ModalUserInfoWrapper, - ModalWrapper, - MoreButton, - Switch, - SwitchRadio, - TextArea, - Top, - Wrapper, -} from './style'; +import MyPageTemplate from './template'; function MyPage(): React.ReactElement { const [selectedSection, setSelectedSection] = useState('scrap'); @@ -68,6 +42,15 @@ function MyPage(): React.ReactElement { setSelectedSection(e.target.id); }; + const handleCommentFold = () => { + setIsFolded(!isFolded); + }; + + const handleChallengeModalOpen = () => { + setIsChallengeModalOpen(false); + setIsFolded(true); + }; + const handleModalOpen = () => { setIsModalOpened(true); }; @@ -79,6 +62,37 @@ function MyPage(): React.ReactElement { setIsModalOpened(false); }; + const renderScrappedConcert = (data: IConcert[]) => { + return data?.map((item: IConcert) => { + return ( + + ); + }); + }; + + const renderChallenge = (data: IChallenge[]) => { + return data?.map((item: IChallenge) => ( + + )); + }; + const fetchMyPageUserInfo = useCallback(async () => { const data = await getMyPageUserInfo(globalUserStatusInfo?.token); setUserInfo(data); @@ -146,161 +160,38 @@ function MyPage(): React.ReactElement { fetchUserCommentList(selectedCategory, currentPage); }, [selectedCategory, currentPage, isReRender, fetchUserCommentList]); - const renderScrappedConcert = (data: IConcert[]) => { - return data?.map((item: IConcert) => { - return ( - - ); - }); - }; - - const renderChallenge = (data: IChallenge[]) => { - return data?.map((item: IChallenge) => ( - - )); - }; - return ( - -
- -
- - -
  • - - -
  • -
  • - - -
  • -
    - - {selectedSection === 'scrap' ? ( - - ) : ( - - )} - - - {selectedSection === 'scrap' ? ( - - ) : ( - userComment && ( - - ) - )} - - - - - - - - - -
    -
    {challenge?.user?.nickname}
    -
    {dayjs().format('MM.DD')}
    -
    -
    {challenge?.interest?.map((item: string) => `#${item} `)}
    -
    -
    - - { - setIsFolded(!isFolded); - }} - > - {isFolded ? '더보기' : '접기'} - - - {challenge?.comments.map((comment) => ( - - ))} - -
    - { - setIsChallengeModalOpen(false); - setIsFolded(true); - }} - > - 닫기 - -
    -
    -
    + ); } diff --git a/src/pages/MyPage/template/index.tsx b/src/pages/MyPage/template/index.tsx index d82cc99a..3554c4c7 100644 --- a/src/pages/MyPage/template/index.tsx +++ b/src/pages/MyPage/template/index.tsx @@ -1,7 +1,164 @@ +import { DeleteModal, MyPageSection } from 'components/molecules'; +import { MyCommentList, MyPageCommentModal, MyPageHeader } from 'components/organisms'; import React from 'react'; +import { IChallenge, IChallengeData } from 'types/challenge.type'; +import { IConcert } from 'types/concert.type'; +import { IUserState } from 'types/global.type'; +import { IMyPageHeader, IMyScrappedChallenge, IMyScrappedConcert, IMyUserCommentResponse } from 'types/myPage.type'; +import * as S from './style'; -function Home(): React.ReactElement { - return
    Home
    ; +export interface IProps { + userInfo: IMyPageHeader | null; + globalUserInfo: IUserState | null; + concertData: IMyScrappedConcert | null; + scrappedChallenge: IMyScrappedChallenge | null; + userChallengeList: IChallengeData[] | null; + userComment: IMyUserCommentResponse | null; + challenge: IChallenge | null; + selectedSection: string; + selectedCategory: string; + isModalOpened: boolean; + isSelectAll: boolean; + isChallengeModalOpen: boolean; + isFolded: boolean; + currentPage: number; + checkedCommentList: string[]; + onChangeSection: (e: React.ChangeEvent) => void; + setSelectedCategory: (value: string) => void; + setCurrentPage: (value: number) => void; + setCheckedCommentList: (value: string[]) => void; + setIsSelectAll: (value: boolean) => void; + setIsModalOpened: (value: boolean) => void; + setIsChallengeModalOpen: (value: boolean) => void; + renderScrappedConcert: (data: IConcert[]) => React.ReactElement[]; + renderChallenge: (data: IChallenge[]) => React.ReactElement[]; + handleModalOpen: () => void; + handleCommentFold: () => void; + fetchLearnMyselfData: (id: string) => Promise; + deleteSelectedCommentList: () => Promise; + handleChallengeModalOpen: () => void; } -export default Home; +function MyPageTemplate({ + userInfo, + globalUserInfo, + concertData, + scrappedChallenge, + userChallengeList, + userComment, + challenge, + selectedSection, + selectedCategory, + isModalOpened, + isSelectAll, + isChallengeModalOpen, + isFolded, + currentPage, + checkedCommentList, + onChangeSection, + setSelectedCategory, + setCurrentPage, + setCheckedCommentList, + setIsSelectAll, + setIsModalOpened, + setIsChallengeModalOpen, + renderScrappedConcert, + renderChallenge, + handleModalOpen, + handleCommentFold, + fetchLearnMyselfData, + deleteSelectedCommentList, + handleChallengeModalOpen, +}: IProps): React.ReactElement { + return ( + + + + + + +
  • + + +
  • +
  • + + +
  • +
    + + {selectedSection === 'scrap' ? ( + + ) : ( + + )} + + + {selectedSection === 'scrap' ? ( + + ) : ( + userComment && ( + + ) + )} + +
    + + +
    + ); +} + +export default MyPageTemplate; diff --git a/src/pages/MyPage/template/style.ts b/src/pages/MyPage/template/style.ts new file mode 100644 index 00000000..6daea096 --- /dev/null +++ b/src/pages/MyPage/template/style.ts @@ -0,0 +1,67 @@ +import Styled from 'styled-components'; +import { palette, theme } from 'styled-tools'; + +export const SwitchRadio = Styled.input` + display: none; + + + label { + cursor: pointer; + color: ${palette('grayscale', 3)}; + } + :checked + label { + color: ${palette('grayscale', 6)}; + padding-bottom: 2px; + background: + linear-gradient(to right, ${palette('primary', 3)}, ${palette('primary', 0)}) + left + bottom + #fff + no-repeat; + background-size: 100% 2px; +} +`; + +export const Switch = Styled.ul` + display: flex; + justify-content: center; + margin-top: 100px; + li { + margin: 0 20px; + } + + label { + ${theme('font.subhead5')}; + } +`; + +export const Wrapper = Styled.div` +`; + +export const Header = Styled.div` + display: flex; + justify-content: center; + width: 100vw; + height: 581px; + background-color: ${palette('grayscale', -2)}; +`; + +export const Body = Styled.div` + display: flex; + flex-direction: column; + align-items: center; +`; + +export const Top = Styled.div` + display: flex; + justify-content: center; + width: 100vw; + margin: 120px 0 150px 0; +`; + +export const Bottom = Styled.div` + display: flex; + justify-content: center; + width: 100vw; + padding: 150px 0; + background-color: #f7f7f7; +`; diff --git a/src/pages/Notice/index.tsx b/src/pages/Notice/index.tsx index 49071474..83622563 100644 --- a/src/pages/Notice/index.tsx +++ b/src/pages/Notice/index.tsx @@ -1,8 +1,7 @@ -import { getNoticeListData, getNoticeSearchData } from 'apis'; -import { NoticeHeader, NoticeList, SearchForm } from 'components/organisms'; +import { getNoticeSearchData } from 'apis'; import React, { useEffect, useState } from 'react'; import { INotice } from 'types/notice.type'; -import { NoticeWrapper } from './style'; +import NoticeTemplate from './template'; function Notice(): React.ReactElement { const [noticeList, setnoticeList] = useState(null); @@ -10,16 +9,6 @@ function Notice(): React.ReactElement { const [currentPage, setCurrentPage] = useState(1); const [totalNoticeNum, setTotalNoticeNum] = useState(0); - useEffect(() => { - const getNoticeList = async (pageIndex: number) => { - const LIMIT_PER_PAGE = 8; - const data = await getNoticeListData({ offset: (pageIndex - 1) * LIMIT_PER_PAGE }); - data && setnoticeList(data.notices); - data && setTotalNoticeNum(data.totalNoticeNum); - }; - getNoticeList(currentPage); - }, [currentPage]); - useEffect(() => { const getNoticeSearchList = async (pageIndex: number) => { const LIMIT_PER_PAGE = 8; @@ -39,27 +28,16 @@ function Notice(): React.ReactElement { const keywordChange = () => { setCurrentPage(1); }; - const noticeListNum = noticeList?.length; + return ( - <> - - - - {noticeList && ( - - )} - - + ); } diff --git a/src/pages/Notice/template/index.tsx b/src/pages/Notice/template/index.tsx index f4aa2adc..7d34a719 100644 --- a/src/pages/Notice/template/index.tsx +++ b/src/pages/Notice/template/index.tsx @@ -1,7 +1,46 @@ +import { NoticeHeader, NoticeList, SearchForm } from 'components/organisms'; import React from 'react'; +import { INotice } from 'types/notice.type'; +import { NoticeWrapper } from './style'; -function Notice(): React.ReactElement { - return
    Notice
    ; +interface IProps { + reRenderKeyword: (keyword: string) => void; + keywordChange: () => void; + noticeList: Array | null; + totalNoticeNum: number; + currentPage: number; + setCurrentPage: (value: number) => void; } -export default Notice; +function NoticeTemplate({ + reRenderKeyword, + keywordChange, + totalNoticeNum, + noticeList, + currentPage, + setCurrentPage, +}: IProps): React.ReactElement { + return ( + <> + + + + {noticeList && ( + + )} + + + ); +} + +export default NoticeTemplate; diff --git a/src/pages/Notice/style.ts b/src/pages/Notice/template/style.ts similarity index 100% rename from src/pages/Notice/style.ts rename to src/pages/Notice/template/style.ts diff --git a/src/pages/NoticeDetail/index.tsx b/src/pages/NoticeDetail/index.tsx index 8cf16cc7..34759844 100644 --- a/src/pages/NoticeDetail/index.tsx +++ b/src/pages/NoticeDetail/index.tsx @@ -1,13 +1,8 @@ import { getNoticeData } from 'apis'; -import { DetailTitle } from 'components/molecules'; -import { DetailContent, NoticeCommentList } from 'components/organisms'; -import React, { useEffect, useState } from 'react'; +import React, { useCallback, useEffect, useState } from 'react'; import { RouteComponentProps } from 'react-router'; -import { useRecoilValue } from 'recoil'; -import { userStatusState } from 'stores/user'; -import { INotice } from 'types/notice.type'; -import { NoticeDetailWrapper } from './style'; - +import { INotice, INoticeComment } from 'types/notice.type'; +import NoticeDetailTemplate from './template'; interface MatchParams { id: string; } @@ -15,45 +10,26 @@ interface MatchParams { function NoticeDetail({ match }: RouteComponentProps): React.ReactElement { const { id } = match.params; const [notice, setNotice] = useState(null); - const [commentList, setCommentList] = useState([]); - const userStatusData = useRecoilValue(userStatusState); - useEffect(() => { - const getConcertList = async () => { - const data = await getNoticeData(id); - data[0] && setNotice(data[0]); - data[0] && setCommentList(data[0].comments); - }; - getConcertList(); - }, [commentList, userStatusData, id]); + const [commentList, setCommentList] = useState([]); + const [isRerender, setIsRerender] = useState(false); - const reLoadComment = (newComment: any) => { - setCommentList(commentList?.concat(newComment)); - }; + const getNoticeContent = useCallback(async () => { + const data = await getNoticeData(id); + data && setNotice(data); + data && setCommentList(data.comments); + }, [id]); + + useEffect(() => { + getNoticeContent(); + }, [isRerender, getNoticeContent]); return ( - - {notice && ( - - )} - {notice && ( - - )} - - + ); } diff --git a/src/pages/NoticeDetail/template/index.tsx b/src/pages/NoticeDetail/template/index.tsx index 83d7cf0d..be42f74f 100644 --- a/src/pages/NoticeDetail/template/index.tsx +++ b/src/pages/NoticeDetail/template/index.tsx @@ -1,7 +1,41 @@ +import { DetailTitle } from 'components/molecules'; +import { DetailContent, NoticeCommentList } from 'components/organisms'; import React from 'react'; - -function NoticeDetail(): React.ReactElement { - return
    NoticeDetail
    ; +import { INotice, INoticeComment } from 'types/notice.type'; +import { NoticeDetailWrapper } from './style'; +interface IProps { + notice: INotice | null; + commentList: Array; + isRerender: boolean; + setIsRerender: (value: boolean) => void; +} +function NoticeDetailTemplate({ notice, commentList, isRerender, setIsRerender }: IProps): React.ReactElement { + return ( + + {notice && ( + + )} + {notice && ( + + )} + + + ); } -export default NoticeDetail; +export default NoticeDetailTemplate; diff --git a/src/pages/NoticeDetail/style.ts b/src/pages/NoticeDetail/template/style.ts similarity index 100% rename from src/pages/NoticeDetail/style.ts rename to src/pages/NoticeDetail/template/style.ts diff --git a/src/pages/ScrappedChallengeList/index.tsx b/src/pages/ScrappedChallengeList/index.tsx index 590abf79..ed5fc37e 100644 --- a/src/pages/ScrappedChallengeList/index.tsx +++ b/src/pages/ScrappedChallengeList/index.tsx @@ -1,5 +1,5 @@ import { getMyPageChallengeList } from 'apis'; -import { ChallengeDetailCard } from 'components/molecules'; +import { ChallengeDetailCard } from 'components/organisms'; import React, { useCallback, useEffect, useState } from 'react'; import { useRecoilValue } from 'recoil'; import { userStatusState } from 'stores/user'; diff --git a/src/pages/Setting/index.tsx b/src/pages/Setting/index.tsx index 8f098677..225f746a 100644 --- a/src/pages/Setting/index.tsx +++ b/src/pages/Setting/index.tsx @@ -1,43 +1,10 @@ -import { Switch, withStyles } from '@material-ui/core'; import { getUserInfo, updateUserInfo } from 'apis'; -import { EditWhiteIcon, XIcon } from 'assets/images'; -import { StyledInput } from 'components/atoms'; -import { DropDown, DropDownMulti } from 'components/molecules'; import React, { useEffect, useRef, useState } from 'react'; import { useHistory, withRouter } from 'react-router-dom'; import { useRecoilValue, useSetRecoilState } from 'recoil'; -import { interestList } from 'resources/string'; import { userState, userStatusState } from 'stores/user'; -import { - Btn, - CategoryContainer, - Container, - DropdownWrapper, - EditBtn, - Email, - InterestList, - InterestTagCntnr, - NicknameInputContainer, - PolicyCntnr, - ProfileContainer, - ProfileImg, - ProfileInput, - PwBtn, - Text, - TextWrapper, - Txt, - TxtSmall, -} from './style'; - -interface IUserInfo { - nickname: string; - img: string; - marpolicy: boolean; - _id: string; - email: string; - gender: number; - interest: string[]; -} +import { ISettingUserInfo } from 'types/setting.type'; +import SettingTemplate from './template'; function Setting(): React.ReactElement { // for edit btn @@ -47,7 +14,7 @@ function Setting(): React.ReactElement { // for user info const setUserData = useSetRecoilState(userState); const userStatusData = useRecoilValue(userStatusState); - const [userInfo, setUserInfo] = useState({ + const [userInfo, setUserInfo] = useState({ nickname: '', img: '', marpolicy: true, @@ -61,6 +28,39 @@ function Setting(): React.ReactElement { const imgInput = useRef(null); const [img, setImg] = useState({}); const [isEmpty, setIsEmpty] = useState(true); + + const handlePasswordBtnClicked = () => { + history.push('/setting/password/set'); + }; + + const handleUserMarpolicy = (e: React.ChangeEvent) => + setUserInfo({ + ...userInfo, + marpolicy: e.target.checked, + }); + + const handleUserGender = (e: string) => + setUserInfo({ + ...userInfo, + gender: e === '남성' ? 0 : e === '여성' ? 1 : 2, + }); + + const handleUserInterest = (e: string) => { + !userInfo.interest.includes(String(e)) && + userInfo.interest.length < 5 && + setUserInfo({ + ...userInfo, + interest: userInfo.interest.concat([String(e)]), + }); + }; + + const handleUserNickname = (nickname: string | number) => { + setUserInfo({ + ...userInfo, + nickname: String(nickname), + }); + }; + const handleInputImg = (e: React.ChangeEvent) => { if (e.target.files) { setUserInfo({ @@ -81,6 +81,10 @@ function Setting(): React.ReactElement { }; const handleClickEdit = async () => { + if (!isBtnAtv) { + return; + } + let data = null; if (!isEmpty) { data = await updateUserInfo( @@ -123,171 +127,20 @@ function Setting(): React.ReactElement { }, [userInfo]); return ( -
    - - - - - - - 아이디 - {userInfo.email} - 닉네임 - - - setUserInfo({ - ...userInfo, - nickname: String(e), - }) - } - isConditionMet={userInfo.nickname !== ''} - errorMsg="닉네임을 입력해주세요" - /> - - 카테고리 - - { - !userInfo.interest.includes(String(e)) && - userInfo.interest.length < 5 && - setUserInfo({ - ...userInfo, - interest: userInfo.interest.concat([String(e)]), - }); - }} - defaultMsg="카테고리를 선택해 주세요 (최대 5개)" - itemList={interestList} - /> - - - {userInfo.interest.map((item: string, idx: number) => { - return ; - })} - - 성별 - - - setUserInfo({ - ...userInfo, - gender: e === '남성' ? 0 : e === '여성' ? 1 : 2, - }) - } - defaultMsg="성별 선택" - itemList={['남성', '여성', '선택안함']} - page="joinform" - isSetting={true} - /> - - 비밀번호 변경 - history.push('/setting/password/set')}>비밀번호 변경하기 - - - 이메일 수신 설정 - 오투에서 진행하는 챌린지, 이벤트, 프로모션에 관한 광고를 수신하겠습니다. - - ) => - setUserInfo({ - ...userInfo, - marpolicy: e.target.checked, - }) - } - name="checkedB" - /> - - { - console.log(''); - } - } - > - 수정완료 - - -
    + ); } export default withRouter(Setting); - -const InterestTag = ({ setList, text }: { setList: (e: string) => void; text: string }) => { - return ( - -
    {text}
    - setList(e.target.id)} /> -
    - ); -}; - -const IOSSwitch = withStyles((theme) => ({ - root: { - width: 42, - height: 26, - padding: 0, - margin: theme.spacing(1), - }, - switchBase: { - 'padding': 1, - '&$checked': { - 'transform': 'translateX(16px)', - 'color': theme.palette.common.white, - '& + $track': { - backgroundColor: '#3d3d3d', - opacity: 1, - border: '#dfdfdf', - }, - }, - '&$focusVisible $thumb': { - color: '#3d3d3d', - border: '6px solid #dfdfdf', - }, - }, - thumb: { - width: 24, - height: 24, - }, - track: { - borderRadius: 26 / 2, - border: `1px solid ${theme.palette.grey[400]}`, - backgroundColor: theme.palette.grey[50], - opacity: 1, - transition: theme.transitions.create(['background-color', 'border']), - }, - checked: {}, - focusVisible: {}, -}))(({ classes, ...props }: any) => { - return ( - - ); -}); diff --git a/src/pages/Setting/template/index.tsx b/src/pages/Setting/template/index.tsx index 0577c789..bdbb4be3 100644 --- a/src/pages/Setting/template/index.tsx +++ b/src/pages/Setting/template/index.tsx @@ -1,7 +1,53 @@ +import { SettingForm } from 'components/organisms'; import React from 'react'; +import { ISettingUserInfo } from 'types/setting.type'; +import * as S from './style'; -function Setting(): React.ReactElement { - return
    Setting
    ; +export interface IProps { + userInfo: ISettingUserInfo; + imgInput: React.RefObject; + isBtnAtv: boolean; + handleInputImg: (e: React.ChangeEvent) => void; + handleUserNickname: (nickname: string) => void; + handleClickDel: (e: string) => void; + handleUserInterest: (e: string) => void; + handleUserGender: (e: string) => void; + handleUserMarpolicy: (e: React.ChangeEvent) => void; + handleClickEdit: () => Promise; + handlePasswordBtnClicked: () => void; } -export default Setting; +function SettingTemplate({ + userInfo, + imgInput, + isBtnAtv, + handleInputImg, + handleUserNickname, + handleClickDel, + handleUserInterest, + handleUserGender, + handleUserMarpolicy, + handleClickEdit, + handlePasswordBtnClicked, +}: IProps): React.ReactElement { + return ( + + + {/* TODO: 회원탈퇴 버튼 들어갈 부분 */} + + ); +} + +export default SettingTemplate; diff --git a/src/pages/Setting/template/style.ts b/src/pages/Setting/template/style.ts new file mode 100644 index 00000000..fe741176 --- /dev/null +++ b/src/pages/Setting/template/style.ts @@ -0,0 +1,11 @@ +import Styled from 'styled-components'; + +export const Container = Styled.div` + width: 100%; + padding: 100px 0 400px 0; + + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; +`; diff --git a/src/stores/user.ts b/src/stores/user.ts index 026f4390..471f409b 100644 --- a/src/stores/user.ts +++ b/src/stores/user.ts @@ -1,26 +1,9 @@ import { atom } from 'recoil'; import { recoilPersist } from 'recoil-persist'; +import { IUserState, IUserStatusState } from 'types/global.type'; const { persistAtom } = recoilPersist(); -interface IUserStatusState { - token: string; - userType: number; - totalGeneration: number; - registGeneration: number | null; - progressGeneration: number; -} - -interface IUserState { - interest: string[]; - marpolicy: boolean; - img: string; - _id: string; - email: string; - nickname: string; - gender: number; -} - export const userState = atom({ key: 'user/atom', default: null, diff --git a/src/types/challenge.type.ts b/src/types/challenge.type.ts index eeb9aa09..57cbfcab 100644 --- a/src/types/challenge.type.ts +++ b/src/types/challenge.type.ts @@ -35,6 +35,7 @@ export interface IChallenge { export interface ICommentData { childrenComment: { + isDeleted?: boolean; _id: string; userID: { img: string; @@ -50,6 +51,7 @@ export interface ICommentData { nickname: string; }; text: string; + isDeleted?: boolean; } export interface IChallengeData { @@ -108,3 +110,15 @@ export interface IReply { }; text?: string; } + +export interface IByte { + byte1: number; + byte2: number; + byte3: number; +} + +export interface ITextForm { + description1: string; + description2: string; + description3: string; +} diff --git a/src/types/concert.type.ts b/src/types/concert.type.ts index 5e9dc688..4044feca 100644 --- a/src/types/concert.type.ts +++ b/src/types/concert.type.ts @@ -19,6 +19,30 @@ export interface IConcert { authorNickname: string; __v: number; } + +export interface IUserConcert { + authorNickname: string; + commentNum: number; + comments: IConcertComment[]; + createdAt: string; + hashtag: string[]; + imgThumbnail: string; + interest: string[]; + isDeleted: boolean; + isLike: boolean; + isNotice: boolean; + isScrap: boolean; + likes: number; + scrapNum: number; + text: string; + title: string; + updatedAt: string; + user: { img: string; nickname: string; _id: string }; + videoLink: string; + __v: number; + _id: string; +} + export interface IConcertList { concerts: IConcert[]; totalConcertNum: number; @@ -26,12 +50,16 @@ export interface IConcertList { export interface IConcertComment { childrenComment: { + idDeleted: boolean; _id: string; - nickname: string; + userID: { + img: string; + _id: string; + nickname: string; + }; text: string; - createdAt?: string; }[]; - isDeleted?: boolean; + isDeleted: boolean; _id: string; userID: { img: string; @@ -41,7 +69,22 @@ export interface IConcertComment { text: string; } -export interface IConcertNewComment { - parentID?: string; +export interface IConcertCommentData { + parentID?: string | null; text: string; } + +export interface IFetchParameter { + token?: string; + limit?: number; + offset?: number; + keyword?: string; + tag?: string; +} + +export interface IFetchComment { + createdAt: string; + nickname: string; + text: string; + _id: string; +} diff --git a/src/types/global.type.ts b/src/types/global.type.ts new file mode 100644 index 00000000..6339bbbc --- /dev/null +++ b/src/types/global.type.ts @@ -0,0 +1,17 @@ +export interface IUserStatusState { + token: string; + userType: number; + totalGeneration: number; + registGeneration: number | null; + progressGeneration: number; +} + +export interface IUserState { + interest: string[]; + marpolicy: boolean; + img: string; + _id: string; + email: string; + nickname: string; + gender: number; +} diff --git a/src/types/join.type.ts b/src/types/join.type.ts index df9974f6..8f1e773e 100644 --- a/src/types/join.type.ts +++ b/src/types/join.type.ts @@ -16,3 +16,14 @@ export interface IJoin { gender: number; marpolicy: boolean; } + +export interface IJoinData { + email: string; + password: string; + passwordCheck: string; + nickname: string; + gender: number; + interest: string[]; + marpolicy: boolean; + policyMust: boolean; +} diff --git a/src/types/notice.type.ts b/src/types/notice.type.ts index 140084bf..d7b34ba2 100644 --- a/src/types/notice.type.ts +++ b/src/types/notice.type.ts @@ -1,6 +1,6 @@ export interface INotice { commentNum: number; - comments: string[]; + comments: INoticeComment[]; createdAt: string; hashtag: string[]; imgThumbnail: string; @@ -28,12 +28,16 @@ export interface ISearchNoticeList { export interface INoticeComment { childrenComment: { + idDeleted: boolean; _id: string; - nickname: string; + userID: { + img: string; + _id: string; + nickname: string; + }; text: string; - createdAt?: string; }[]; - isDeleted?: boolean; + isDeleted: boolean; _id: string; userID: { img: string; @@ -43,7 +47,22 @@ export interface INoticeComment { text: string; } -export interface INoticeNewComment { - parentID?: string; +export interface INoticeCommentData { + parentID?: string | null; text: string; } + +export interface IFetchParameter { + token?: string; + limit?: number; + offset?: number; + keyword?: string; + tag?: string; +} + +export interface IFetchComment { + createdAt: string; + nickname: string; + text: string; + _id: string; +} diff --git a/src/types/setting.type.ts b/src/types/setting.type.ts new file mode 100644 index 00000000..4eb35eef --- /dev/null +++ b/src/types/setting.type.ts @@ -0,0 +1,9 @@ +export interface ISettingUserInfo { + nickname: string; + img: string; + marpolicy: boolean; + _id: string; + email: string; + gender: number; + interest: string[]; +}