1 line
17 KiB
JSON
1 line
17 KiB
JSON
|
|
{"ast":null,"code":"var _jsxFileName = \"D:\\\\aiproject\\\\goAgent\\\\todo\\\\client\\\\src\\\\components\\\\TodoForm.js\",\n _s = $RefreshSig$();\nimport React, { useState } from 'react';\nimport styled from 'styled-components';\nimport { jsxDEV as _jsxDEV } from \"react/jsx-dev-runtime\";\nconst FormContainer = styled.div`\n background: rgba(102, 126, 234, 0.05);\n border-radius: 20px;\n padding: 35px;\n border: 2px solid rgba(102, 126, 234, 0.1);\n`;\n_c = FormContainer;\nconst Form = styled.form`\n display: flex;\n flex-direction: column;\n gap: 20px;\n`;\n_c2 = Form;\nconst InputRow = styled.div`\n display: flex;\n gap: 20px;\n align-items: flex-end;\n \n @media (max-width: 1024px) {\n flex-direction: column;\n align-items: stretch;\n gap: 15px;\n }\n`;\n_c3 = InputRow;\nconst InputGroup = styled.div`\n display: flex;\n flex-direction: column;\n gap: 10px;\n flex: 1;\n`;\n_c4 = InputGroup;\nconst Label = styled.label`\n font-size: 15px;\n font-weight: 600;\n color: #555;\n`;\n_c5 = Label;\nconst Input = styled.input`\n padding: 16px 20px;\n border: 2px solid #e1e5e9;\n border-radius: 12px;\n font-size: 16px;\n transition: all 0.3s ease;\n outline: none;\n\n &:focus {\n border-color: #667eea;\n box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);\n }\n\n &::placeholder {\n color: #a0a0a0;\n }\n`;\n_c6 = Input;\nconst Select = styled.select`\n padding: 16px 20px;\n border: 2px solid #e1e5e9;\n border-radius: 12px;\n font-size: 16px;\n background: white;\n cursor: pointer;\n transition: all 0.3s ease;\n outline: none;\n\n &:focus {\n border-color: #667eea;\n box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);\n }\n`;\n_c7 = Select;\nconst Button = styled.button`\n background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);\n color: white;\n border: none;\n padding: 16px 32px;\n border-radius: 12px;\n font-size: 16px;\n font-weight: 600;\n cursor: pointer;\n transition: all 0.3s ease;\n white-space: nowrap;\n\n &:hover {\n transform: translateY(-2px);\n box-shadow: 0 10px 20px rgba(102, 126, 234, 0.3);\n }\n\n &:disabled {\n opacity: 0.6;\n cursor: not-allowed;\n transform: none;\n }\n`;\n_c8 = Button;\nconst priorityOptions = [{\n value: 'low',\n label: '低优先级',\n color: '#95a5a6'\n}, {\n value: 'medium',\n label: '中优先级',\n color: '#3498db'\n}, {\n value: 'high',\n label: '高优先级',\n color: '#e67e22'\n}, {\n value: 'urgent',\n label: '紧急',\n color: '#e74c3c'\n}];\nfunction TodoForm({\n onAddTodo\n}) {\n _s();\n const [title, setTitle] = useState('');\n const [priority, setPriority] = useState('medium');\n const [date, setDate] = useState(new Date().toISOString().split('T')[0]);\n const [loading, setLoading] = useState(false);\n const handleSubmit = async e => {\n e.preventDefault();\n if (!title.trim()) return;\n setLoading(true);\n try {\n await onAddTodo({\n title: title.trim(),\n priority,\n date\n });\n setTitle('');\n setPriority('medium');\n } catch (error) {\n console.error('Add todo error:', error);\n } finally {\n setLoading(false);\n }\n };\n return /*#__PURE__*/_jsxDEV(FormContainer, {\n children: /*#__PURE__*/_jsxDEV(Form, {\n onSubmit: handleSubmit,\n children: /*#__PURE__*/_jsxDEV(InputRow, {\n children: [/*#__PURE__*/_jsxDEV(InputGroup, {\n style: {\n flex: 3\n },\n children: [/*#__PURE__*/_jsxDEV(Label, {\n children: \"\\u5F85\\u529E\\u4E8B\\u9879\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 138,\n columnNumber: 13\n }, this), /*#__PURE__*/_jsxDEV(Input, {\n type: \"text\",\n placeholder: \"\\u8F93\\u5165\\u5F85\\u529E\\u4E8B\\u9879\\u5185\\u5BB9...\",\n value: title,\n onChange: e => setTitle(e.target.value),\n required: true\n }, void 0, false, {\n fileName: _jsxFileName,\n li
|