ui 디자인 수정 .
This commit is contained in:
1 parent
24d61f925a
commit
07ba65cca6
27 files changed
+2738
-725
No files matched your search
@@ -1,5 +1,5 @@
|
||||
|
||||
import React, { useRef, useState } from 'react';
|
||||
import React, { useRef, useState, useEffect } from 'react';
|
||||
import { ImageItem, ImageUrlItem } from '../../types/api';
|
||||
import { uploadImages } from '../../utils/api';
|
||||
|
||||
@@ -11,6 +11,8 @@ interface AssetManagementContentProps {
|
||||
onAddImages: (files: File[]) => void;
|
||||
}
|
||||
|
||||
type VideoRatio = 'vertical' | 'horizontal';
|
||||
|
||||
const AssetManagementContent: React.FC<AssetManagementContentProps> = ({
|
||||
onBack,
|
||||
onNext,
|
||||
@@ -22,6 +24,21 @@ const AssetManagementContent: React.FC<AssetManagementContentProps> = ({
|
||||
const imageListRef = useRef<HTMLDivElement>(null);
|
||||
const [isUploading, setIsUploading] = useState(false);
|
||||
const [uploadError, setUploadError] = useState<string | null>(null);
|
||||
const [videoRatio, setVideoRatio] = useState<VideoRatio>('vertical');
|
||||
|
||||
// Load video ratio from localStorage on mount
|
||||
useEffect(() => {
|
||||
const savedRatio = localStorage.getItem('castad_video_ratio') as VideoRatio;
|
||||
if (savedRatio === 'vertical' || savedRatio === 'horizontal') {
|
||||
setVideoRatio(savedRatio);
|
||||
}
|
||||
}, []);
|
||||
|
||||
// Save video ratio to localStorage when it changes
|
||||
const handleVideoRatioChange = (ratio: VideoRatio) => {
|
||||
setVideoRatio(ratio);
|
||||
localStorage.setItem('castad_video_ratio', ratio);
|
||||
};
|
||||
|
||||
const getImageSrc = (item: ImageItem): string => {
|
||||
return item.type === 'url' ? item.url : item.preview;
|
||||
@@ -105,54 +122,60 @@ const AssetManagementContent: React.FC<AssetManagementContentProps> = ({
|
||||
|
||||
return (
|
||||
<main className="page-container">
|
||||
{/* Back Button */}
|
||||
<div className="back-button-container">
|
||||
<button onClick={onBack} className="btn-back">
|
||||
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2">
|
||||
{/* Header with Back Button and Progress */}
|
||||
<div className="asset-header">
|
||||
<button onClick={onBack} className="btn-back-new">
|
||||
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2">
|
||||
<path d="M15 18l-6-6 6-6" />
|
||||
</svg>
|
||||
뒤로가기
|
||||
<span>뒤로가기</span>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
{/* Header */}
|
||||
<div className="page-header">
|
||||
<h1 className="page-title">브랜드 에셋</h1>
|
||||
<p className="page-subtitle">
|
||||
쉽고 빠르게, 브랜드 소셜 미디어 캠페인을 만드세요.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
{/* Main Content */}
|
||||
<div className="main-content">
|
||||
{/* Selected Images Card */}
|
||||
<div className="card card-flex card-flex-2 card-overflow-hidden">
|
||||
<div className="flex-between mb-4 shrink-0">
|
||||
<h3 className="section-title mb-0">선택된 이미지</h3>
|
||||
<span className="text-gray-400 text-sm">{imageList.length}장</span>
|
||||
<div className="progress-indicator">
|
||||
<div className="progress-label">
|
||||
<span className="progress-text">단계</span>
|
||||
<div className="progress-numbers">
|
||||
<span className="progress-current">1</span>
|
||||
<span className="progress-divider">/</span>
|
||||
<span className="progress-total">2</span>
|
||||
</div>
|
||||
</div>
|
||||
<div className="progress-bar-wrapper">
|
||||
<div className="progress-bar-fill" style={{ width: '50%' }}></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Title */}
|
||||
<h1 className="asset-title">브랜드 에셋</h1>
|
||||
|
||||
{/* Main Content Container */}
|
||||
<div className="asset-container">
|
||||
{/* Left Column - Selected Images */}
|
||||
<div className="asset-column asset-column-left">
|
||||
<h3 className="asset-section-title">선택된 이미지</h3>
|
||||
<div
|
||||
ref={imageListRef}
|
||||
onWheel={handleImageListWheel}
|
||||
className="overflow-y-auto flex-1 min-h-0 custom-scrollbar"
|
||||
className="asset-image-list"
|
||||
style={{ overscrollBehavior: 'contain' }}
|
||||
>
|
||||
{imageList.length > 0 ? (
|
||||
<div className="image-grid">
|
||||
<div className="asset-image-grid">
|
||||
{imageList.map((item, i) => (
|
||||
<div key={i} className="image-item">
|
||||
<div key={i} className="asset-image-item">
|
||||
<img
|
||||
src={getImageSrc(item)}
|
||||
alt={`이미지 ${i + 1}`}
|
||||
/>
|
||||
{item.type === 'file' && (
|
||||
<div className="image-item-badge">NEW</div>
|
||||
<div className="asset-image-badge">업로드</div>
|
||||
)}
|
||||
<button
|
||||
onClick={() => onRemoveImage(i)}
|
||||
className="image-item-remove"
|
||||
className="asset-image-remove"
|
||||
>
|
||||
<svg className="w-4 h-4" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2.5">
|
||||
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2.5">
|
||||
<line x1="18" y1="6" x2="6" y2="18"/>
|
||||
<line x1="6" y1="6" x2="18" y2="18"/>
|
||||
</svg>
|
||||
@@ -160,57 +183,71 @@ const AssetManagementContent: React.FC<AssetManagementContentProps> = ({
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
) : (
|
||||
<div className="flex-center text-gray-500 text-base h-full">
|
||||
이미지가 없습니다
|
||||
</div>
|
||||
)}
|
||||
) : null}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Upload Card */}
|
||||
<div className="card card-flex card-flex-1" style={{ minHeight: '200px' }}>
|
||||
<h3 className="section-title">이미지 업로드</h3>
|
||||
<div
|
||||
onClick={handleFileSelect}
|
||||
onDragOver={handleDragOver}
|
||||
onDrop={handleDrop}
|
||||
className="upload-zone"
|
||||
>
|
||||
<div className="upload-zone-icon">
|
||||
<svg className="w-12 h-12" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.5">
|
||||
<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/>
|
||||
<polyline points="17 8 12 3 7 8"/>
|
||||
<line x1="12" y1="3" x2="12" y2="15"/>
|
||||
</svg>
|
||||
{/* Right Column - Upload and Video Ratio */}
|
||||
<div className="asset-column asset-column-right">
|
||||
{/* Image Upload Section */}
|
||||
<div className="asset-upload-section">
|
||||
<h3 className="asset-section-title">이미지 업로드</h3>
|
||||
<div
|
||||
onClick={handleFileSelect}
|
||||
onDragOver={handleDragOver}
|
||||
onDrop={handleDrop}
|
||||
className="asset-upload-zone"
|
||||
>
|
||||
<p className="asset-upload-text">
|
||||
이미지를 드래그하여<br/>업로드
|
||||
</p>
|
||||
</div>
|
||||
<input
|
||||
ref={fileInputRef}
|
||||
type="file"
|
||||
accept="image/*"
|
||||
multiple
|
||||
onChange={handleFileChange}
|
||||
className="hidden"
|
||||
/>
|
||||
</div>
|
||||
|
||||
{/* Video Ratio Section */}
|
||||
<div className="asset-ratio-section">
|
||||
<h3 className="asset-section-title">영상 비율</h3>
|
||||
<div className="asset-ratio-buttons">
|
||||
<button
|
||||
onClick={() => handleVideoRatioChange('vertical')}
|
||||
className={`asset-ratio-button ${videoRatio === 'vertical' ? 'active' : ''}`}
|
||||
>
|
||||
<div className="asset-ratio-icon asset-ratio-icon-vertical">
|
||||
<div className="asset-ratio-box"></div>
|
||||
</div>
|
||||
<span>9:16</span>
|
||||
</button>
|
||||
<button
|
||||
onClick={() => handleVideoRatioChange('horizontal')}
|
||||
className={`asset-ratio-button ${videoRatio === 'horizontal' ? 'active' : ''}`}
|
||||
>
|
||||
<div className="asset-ratio-icon asset-ratio-icon-horizontal">
|
||||
<div className="asset-ratio-box"></div>
|
||||
</div>
|
||||
<span>16:9</span>
|
||||
</button>
|
||||
</div>
|
||||
<p className="upload-zone-title">
|
||||
이미지를 드래그하여<br/>업로드
|
||||
</p>
|
||||
<p className="upload-zone-subtitle">
|
||||
또는 클릭하여 파일 선택
|
||||
</p>
|
||||
</div>
|
||||
<input
|
||||
ref={fileInputRef}
|
||||
type="file"
|
||||
accept="image/*"
|
||||
multiple
|
||||
onChange={handleFileChange}
|
||||
className="hidden"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Bottom Button */}
|
||||
<div className="bottom-button-container">
|
||||
<div className="asset-bottom">
|
||||
{uploadError && (
|
||||
<p className="text-red-500 text-sm mb-2">{uploadError}</p>
|
||||
)}
|
||||
<button
|
||||
onClick={handleNextWithUpload}
|
||||
disabled={imageList.length === 0 || isUploading}
|
||||
className={`btn-primary ${imageList.length === 0 || isUploading ? 'disabled' : ''}`}
|
||||
className="asset-next-button"
|
||||
>
|
||||
{isUploading ? '업로드 중...' : '다음 단계'}
|
||||
</button>
|
||||
|
||||
Reference in new issue
Block a user