<template>
	<!-- 场景构图 -->
	<div class="scene-composition">
		<p class="label">Prompt</p>
		<my-textarea v-model="data.prompt" />
		<p class="label">Choose Style</p>
		<div class="style-list">
			<div
				class="item"
				v-for="v in styleList"
				:key="v.value"
				:class="{ active: data.styles.includes(v.value) }"
				@click="onClickStyle(v.value)"
			>
				<span class="icon">
					<svg-icon name="add" color="#0D0D0D" size="8" size-unit="px" />
				</span>
				<span class="label">{{ v.label }}</span>
			</div>
		</div>
	</div>
</template>

<script setup lang="ts">
	import { computed, ref, reactive, onMounted } from 'vue'
	import myTextarea from '../../tools/my-textarea.vue'
	const styleList = ref([
		{ label: 'Colorful', value: 'Colorful' },
		{ label: 'Minimalist', value: 'Minimalist' },
		{ label: 'Modernist', value: 'Modernist' },
		{ label: 'Bauhaus', value: 'Bauhaus' },
		{ label: 'Mintage', value: 'Mintage' },
		{ label: 'Industrial', value: 'Industrial' },
		{ label: 'Futuristic', value: 'Futuristic' },
		{ label: 'Elegant', value: 'Elegant' },
		{ label: 'Organic', value: 'Organic' },
		{ label: 'Calm', value: 'Calm' },
		{ label: 'Abstract', value: 'Abstract' },
		{ label: 'Kitsch-core', value: 'Kitsch-core' },
		{ label: 'Sophisticated', value: 'Sophisticated' },
		{ label: 'Maximalism', value: 'Maximalism' },
		{ label: 'Clean', value: 'Clean' },
		{ label: 'Bright Colors', value: 'Bright Colors' },
		{ label: 'Luxurious', value: 'Luxurious' },
		{ label: 'Bold Colors', value: 'Bold Colors' },
		{ label: 'Brutalism', value: 'Brutalism' }
	])
	const data = reactive({
		prompt: '',
		styles: ['Colorful', 'Modernist']
	})
	const onClickStyle = (value: string) => {
		if (data.styles.includes(value)) {
			data.styles = data.styles.filter((v) => v !== value)
		} else {
			data.styles.push(value)
		}
	}
	defineExpose({ data })
</script>

<style lang="less" scoped>
	.scene-composition {
		> .style-list {
			display: flex;
			flex-wrap: wrap;
			gap: 8.29px 5.5px;
			user-select: none;
			> .item {
				cursor: pointer;
				display: flex;
				align-items: center;
				justify-content: center;
				padding: 5px 7px;
				font-family: Medium;
				border-radius: 20px;
				font-size: 8.29px;
				border: 1px solid #e4e4e7;
				color: #000;
				> .icon {
					margin-right: 4px;
				}
				&.active {
					border-color: #0095ff;
					background-color: rgba(0, 149, 255, 0.05);
				}
			}
		}
	}
</style>
