diff --git a/frontend/.storybook/preview.js b/frontend/.storybook/preview.js index 161970258..0140c6653 100644 --- a/frontend/.storybook/preview.js +++ b/frontend/.storybook/preview.js @@ -6,11 +6,11 @@ import axios from "axios"; import "../src/api/api"; import { RecruitmentContext } from "../src/hooks/useRecruitmentContext"; import { recruitmentFilter } from "../src/provider/RecruitmentProvider"; -import FormProvider from "../src/provider/FormProvider/FormProvider"; import TokenProvider from "../src/provider/TokenProvider"; -import useForm from "../src/hooks/useForm"; import "../src/App.css"; +import FormProvider from "../src/provider/FormProvider"; +import useForm from "../src/hooks/useForm"; export const API_BASE_URL = process.env.REACT_APP_API_BASE_URL; axios.defaults.baseURL = API_BASE_URL; diff --git a/frontend/jsconfig.json b/frontend/jsconfig.json new file mode 100644 index 000000000..2c4580fcd --- /dev/null +++ b/frontend/jsconfig.json @@ -0,0 +1,8 @@ +{ + "compilerOptions": { + "module": "es6", + "target": "esnext" + }, + "include": ["src/**/*"], + "exclude": ["node_modules"] +} diff --git a/frontend/src/App.css b/frontend/src/App.css index 6a7ce2518..46ea5d203 100644 --- a/frontend/src/App.css +++ b/frontend/src/App.css @@ -62,3 +62,10 @@ button { margin: 0 auto; padding: 2.5rem 0; } + +input, +textarea { + -webkit-appearance: none; + -moz-appearance: none; + appearance: none; +} diff --git a/frontend/src/components/form/Button/Button.js b/frontend/src/components/@common/Button/Button.js similarity index 97% rename from frontend/src/components/form/Button/Button.js rename to frontend/src/components/@common/Button/Button.js index 925ef0623..66e355b68 100644 --- a/frontend/src/components/form/Button/Button.js +++ b/frontend/src/components/@common/Button/Button.js @@ -25,7 +25,6 @@ Button.propTypes = { }; Button.defaultProps = { - type: "button", cancel: false, }; diff --git a/frontend/src/components/form/Button/Button.module.css b/frontend/src/components/@common/Button/Button.module.css similarity index 100% rename from frontend/src/components/form/Button/Button.module.css rename to frontend/src/components/@common/Button/Button.module.css diff --git a/frontend/src/components/form/Button/Button.stories.js b/frontend/src/components/@common/Button/Button.stories.js similarity index 100% rename from frontend/src/components/form/Button/Button.stories.js rename to frontend/src/components/@common/Button/Button.stories.js diff --git a/frontend/src/components/Container/Container.js b/frontend/src/components/@common/Container/Container.js similarity index 100% rename from frontend/src/components/Container/Container.js rename to frontend/src/components/@common/Container/Container.js diff --git a/frontend/src/components/Container/Container.module.css b/frontend/src/components/@common/Container/Container.module.css similarity index 100% rename from frontend/src/components/Container/Container.module.css rename to frontend/src/components/@common/Container/Container.module.css diff --git a/frontend/src/components/Container/Container.stories.js b/frontend/src/components/@common/Container/Container.stories.js similarity index 100% rename from frontend/src/components/Container/Container.stories.js rename to frontend/src/components/@common/Container/Container.stories.js diff --git a/frontend/src/components/form/Description/Description.js b/frontend/src/components/@common/Description/Description.js similarity index 100% rename from frontend/src/components/form/Description/Description.js rename to frontend/src/components/@common/Description/Description.js diff --git a/frontend/src/components/form/Description/Description.module.css b/frontend/src/components/@common/Description/Description.module.css similarity index 100% rename from frontend/src/components/form/Description/Description.module.css rename to frontend/src/components/@common/Description/Description.module.css diff --git a/frontend/src/components/form/Description/Description.stories.js b/frontend/src/components/@common/Description/Description.stories.js similarity index 100% rename from frontend/src/components/form/Description/Description.stories.js rename to frontend/src/components/@common/Description/Description.stories.js diff --git a/frontend/src/components/form/Label/Label.js b/frontend/src/components/@common/Label/Label.js similarity index 100% rename from frontend/src/components/form/Label/Label.js rename to frontend/src/components/@common/Label/Label.js diff --git a/frontend/src/components/form/Label/Label.module.css b/frontend/src/components/@common/Label/Label.module.css similarity index 100% rename from frontend/src/components/form/Label/Label.module.css rename to frontend/src/components/@common/Label/Label.module.css diff --git a/frontend/src/components/form/Label/Label.stories.js b/frontend/src/components/@common/Label/Label.stories.js similarity index 100% rename from frontend/src/components/form/Label/Label.stories.js rename to frontend/src/components/@common/Label/Label.stories.js diff --git a/frontend/src/components/@common/MessageTextInput/MessageTextInput.js b/frontend/src/components/@common/MessageTextInput/MessageTextInput.js new file mode 100644 index 000000000..890a3b42b --- /dev/null +++ b/frontend/src/components/@common/MessageTextInput/MessageTextInput.js @@ -0,0 +1,55 @@ +import PropTypes from "prop-types"; +import Description from "../Description/Description"; +import TextInput from "../TextInput/TextInput"; +import styles from "./MessageTextInput.module.css"; +import Label from "../Label/Label"; + +const MessageTextInput = ({ + label, + description, + initialValue, + value, + onChange, + name, + maxLength, + required, + errorMessage, + ...props +}) => { + return ( + <> +
{errorMessage}
+ > + ); +}; + +MessageTextInput.propTypes = { + label: PropTypes.string, + initialValue: PropTypes.string, + name: PropTypes.string.isRequired, + required: PropTypes.bool, + description: PropTypes.node, + maxLength: PropTypes.number, + errorMessage: PropTypes.string, +}; + +MessageTextInput.defaultProps = { + label: "", + initialValue: "", + required: false, + description: "", +}; + +export default MessageTextInput; diff --git a/frontend/src/components/form/TextField/TextField.module.css b/frontend/src/components/@common/MessageTextInput/MessageTextInput.module.css similarity index 92% rename from frontend/src/components/form/TextField/TextField.module.css rename to frontend/src/components/@common/MessageTextInput/MessageTextInput.module.css index 605a1692a..62ff83747 100644 --- a/frontend/src/components/form/TextField/TextField.module.css +++ b/frontend/src/components/@common/MessageTextInput/MessageTextInput.module.css @@ -1,6 +1,7 @@ .text-field { display: flex; flex-direction: column; + margin: 0.625rem; } .length-limit { diff --git a/frontend/src/components/@common/MessageTextInput/MessageTextInput.stories.js b/frontend/src/components/@common/MessageTextInput/MessageTextInput.stories.js new file mode 100644 index 000000000..1e5c9a727 --- /dev/null +++ b/frontend/src/components/@common/MessageTextInput/MessageTextInput.stories.js @@ -0,0 +1,33 @@ +import React from "react"; +import MessageTextInput from "./MessageTextInput"; + +export default { + title: "form/MessageTextInput", + component: MessageTextInput, +}; + +const Template = (args) =>{errorMessage}
+ > + ); +}; + +MessageTextarea.propTypes = { + label: PropTypes.string, + required: PropTypes.bool, + description: PropTypes.node, + maxLength: PropTypes.number, + initialValue: PropTypes.string, + name: PropTypes.string.isRequired, +}; + +MessageTextarea.defaultProps = { + label: "", + initialValue: "", + required: false, + description: "", +}; + +export default MessageTextarea; diff --git a/frontend/src/components/@common/MessageTextarea/MessageTextarea.module.css b/frontend/src/components/@common/MessageTextarea/MessageTextarea.module.css new file mode 100644 index 000000000..62ff83747 --- /dev/null +++ b/frontend/src/components/@common/MessageTextarea/MessageTextarea.module.css @@ -0,0 +1,19 @@ +.text-field { + display: flex; + flex-direction: column; + margin: 0.625rem; +} + +.length-limit { + align-self: flex-end; + color: #999999; + font-size: 13px; +} + +.rule-field { + margin-left: 8px; + margin-bottom: 10px; + height: 12px; + font-size: 12px; + color: #ff0000; +} diff --git a/frontend/src/components/form/TextField/TextField.stories.js b/frontend/src/components/@common/MessageTextarea/MessageTextarea.stories.js similarity index 74% rename from frontend/src/components/form/TextField/TextField.stories.js rename to frontend/src/components/@common/MessageTextarea/MessageTextarea.stories.js index 67016e20d..fb392570a 100644 --- a/frontend/src/components/form/TextField/TextField.stories.js +++ b/frontend/src/components/@common/MessageTextarea/MessageTextarea.stories.js @@ -1,12 +1,12 @@ import React from "react"; -import TextField from "./TextField"; +import MessageTextarea from "./MessageTextarea"; export default { - title: "form/TextField", - component: TextField, + title: "form/MessageTextarea", + component: MessageTextarea, }; -const Template = (args) =>