-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'dev' of github.com:boostcampwm-2024/web31-BooLock into …
…feat/37
- Loading branch information
Showing
18 changed files
with
606 additions
and
316 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { create } from 'zustand'; | ||
|
||
type TclassBlock = { | ||
classBlockList: string[]; | ||
addClassBlock: (newClassBlockName: string) => void | ||
}; | ||
|
||
export const useClassBlockStore = create<TclassBlock>((set) => ({ | ||
classBlockList: [], | ||
addClassBlock: (newClassBlockName: string) => { | ||
set((state) => ({ | ||
classBlockList: [...state.classBlockList, newClassBlockName], | ||
})); | ||
}, | ||
})); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
import { useState } from 'react'; | ||
import Question from '@/shared/assets/question.svg?react'; | ||
|
||
export const CssPropsSelectBox = () => { | ||
const cssCategoriesObj: { [key: string]: { label: string; items: string[] } } = { | ||
layout: { | ||
label: '레이아웃', | ||
items: ['display', 'position', 'top', 'right', 'bottom', 'left', 'float', 'z-index'], | ||
}, | ||
boxmodel: { | ||
label: '박스모델', | ||
items: ['width', 'height', 'box-sizing', 'overflow'], | ||
}, | ||
typography: { | ||
label: '타이포그래피', | ||
items: ['line-height', 'font-size', 'text-align', 'color'], | ||
}, | ||
background: { | ||
label: '배경', | ||
items: ['background-color'], | ||
}, | ||
border: { | ||
label: '테두리', | ||
items: ['border', 'border-radius', 'border-width'], | ||
}, | ||
spacing: { | ||
label: '간격', | ||
items: ['margin', 'padding'], | ||
}, | ||
flexProperties: { | ||
label: 'flex 속성', | ||
items: ['flex', 'flex-direction', 'justify-content', 'align-items'], | ||
}, | ||
gridProperties: { | ||
label: 'grid 속성', | ||
items: ['grid', 'grid-template-rows', 'grid-template-columns', 'gap'], | ||
}, | ||
}; | ||
|
||
const [selectedCssCategory, setSelectedCssCategory] = useState('layout'); | ||
const [checkedProperties, setCheckedProperties] = useState<{ [key: string]: boolean }>({}); | ||
|
||
// 체크박스 상태 변경 함수 | ||
const handleCheckboxChange = (property: string) => { | ||
setCheckedProperties((prev) => ({ | ||
...prev, | ||
[property]: !prev[property], | ||
})); | ||
}; | ||
|
||
return ( | ||
<section className="flex h-[26rem] w-full"> | ||
<nav className="flex flex-shrink-0 flex-col gap-1.5 overflow-y-scroll border-r border-r-gray-100 px-4 py-3"> | ||
{Object.keys(cssCategoriesObj).map((cssCategory) => ( | ||
<button | ||
key={cssCategory} | ||
onClick={() => setSelectedCssCategory(cssCategory)} | ||
className={`text-bold-sm flex cursor-pointer rounded p-3 text-gray-200 ${selectedCssCategory === cssCategory && 'text-gray-black bg-yellow-500'}`} | ||
> | ||
{cssCategory} | ||
</button> | ||
))} | ||
</nav> | ||
<article className="flex h-full w-full flex-col gap-4 overflow-y-scroll p-3"> | ||
{cssCategoriesObj[selectedCssCategory].items.map((cssName, index) => ( | ||
<div | ||
key={index} | ||
className={`flex h-[66px] w-full flex-shrink-0 items-center justify-between rounded-lg px-4 ${ | ||
checkedProperties[cssName] ? 'bg-yellow-500' : 'bg-gray-50' | ||
}`} | ||
> | ||
<div className="flex items-center gap-5"> | ||
<input | ||
type="checkbox" | ||
checked={!!checkedProperties[cssName]} | ||
onChange={() => handleCheckboxChange(cssName)} | ||
title={cssName} | ||
className="h-5 w-5 appearance-none rounded border border-gray-100 bg-center bg-no-repeat checked:bg-white checked:bg-[url('@/shared/assets/check.svg')]" | ||
/> | ||
<div className="flex items-center gap-2"> | ||
<span className="text-semibold-md text-gray-black max-w-32 truncate border-gray-100"> | ||
{cssName} | ||
</span> | ||
<Question /> | ||
</div> | ||
</div> | ||
<div className="truncate">영재</div> | ||
</div> | ||
))} | ||
</article> | ||
</section> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import { useState } from 'react'; | ||
|
||
type PreviewBoxProps = { | ||
htmlCode: string; | ||
}; | ||
|
||
export const PreviewBox = ({ htmlCode }: PreviewBoxProps) => { | ||
const [activeTab, setActiveTab] = useState<'preview' | 'html' | 'css'>('preview'); | ||
|
||
return ( | ||
<section className="flex-1 border-b border-gray-100"> | ||
<nav className="flex h-10 border-b border-gray-100"> | ||
<button | ||
onClick={() => setActiveTab('preview')} | ||
className={`${activeTab === 'preview' ? 'bg-green-500 text-white' : 'bg-white text-gray-200'} h-full flex-1 border-r border-gray-100 bg-green-500`} | ||
> | ||
미리보기 | ||
</button> | ||
<button | ||
onClick={() => setActiveTab('html')} | ||
className={`${activeTab === 'html' ? 'bg-green-500 text-white' : 'bg-white text-gray-200'} h-full flex-1 border-r border-gray-100 bg-green-500`} | ||
> | ||
HTML | ||
</button> | ||
<button | ||
onClick={() => setActiveTab('css')} | ||
className={`${activeTab === 'css' ? 'bg-green-500 text-white' : 'bg-white text-gray-200'} h-full flex-1 bg-green-500`} | ||
> | ||
CSS | ||
</button> | ||
</nav> | ||
<div className="min-h-[20rem]"> | ||
{activeTab === 'preview' && <iframe srcDoc={htmlCode} title="Preview"></iframe>} | ||
{activeTab === 'html' && <pre className="whitespace-pre-wrap">{htmlCode}</pre>} | ||
{activeTab === 'css' && <p>css 파싱 기능은 구현 중 입니다.</p>} | ||
</div> | ||
</section> | ||
); | ||
}; |
Oops, something went wrong.