Refactor layout.js and CanvasLayout.jsx

This commit is contained in:
yoosangwook 2024-09-19 09:54:31 +09:00
parent 33d2ba50e9
commit 614dfe2000
4 changed files with 12 additions and 7 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

View File

@ -10,10 +10,10 @@ import { ToastContainer } from 'react-toastify'
import Header from '@/components/header/Header'
import QModal from '@/components/common/modal/QModal'
import { QcastProvider } from './QcastProvider'
import './globals.css'
import '../styles/style.scss'
import { QcastProvider } from './QcastProvider'
const inter = Inter({ subsets: ['latin'] })

View File

@ -11,10 +11,9 @@ import { useRecoilState } from 'recoil'
import { globalLocaleStore } from '@/store/localeAtom'
import { modalContent, modalState } from '@/store/modalAtom'
export default function Login(props) {
export default function Login() {
const { patch } = useAxios()
const { currentLocale } = props
const { getMessage } = useMessage()
const [globalLocaleState, setGlbalLocaleState] = useRecoilState(globalLocaleStore)
const [isSelected, setIsSelected] = useState(globalLocaleState === 'ko' ? true : false)

View File

@ -1,15 +1,15 @@
'use client'
import { useState } from 'react'
import { useEffect, useState } from 'react'
import CanvasFrame from './CanvasFrame'
import { useRecoilState, useRecoilValue } from 'recoil'
import { currentMenuState, stepState } from '@/store/canvasAtom'
export default function CanvasLayout() {
const [plans, setPlans] = useState([
{ id: 0, name: 'Plan 1' },
{ id: 1, name: 'Plan 2' },
{ id: 2, name: 'Plan 3' },
{ id: 0, name: 'Plan 1', isCurrent: false },
{ id: 1, name: 'Plan 2', isCurrent: false },
{ id: 2, name: 'Plan 3', isCurrent: false },
])
const [idxNum, setIdxNum] = useState(null)
@ -26,6 +26,12 @@ export default function CanvasLayout() {
setPlans([...plans, { id: plans.length, name: `Plan ${plans.length + 1}` }])
}
useEffect(() => {
if (plans.length === 1) {
setPlans([{ id: 0, name: 'Plan 1', isCurrent: false }])
}
}, [])
return (
<div className="canvas-layout">
<div className="canvas-page-list">