<template>
	<header class="cwg-pc-header">
		<div class="left">
			<cwg-icon :name="!sidebarVisible ? 'crm-bars-staggered' : 'cwg-close'" color="#141d22"
				@click="openLeftDrawer" />
		</div>
		<div class="left">
			<image class="left-img" src="/static/images/logo.png" mode="widthFix" alt="logo" />
		</div>
		<div class="right">
			<cwg-notice />
			<cwg-right-drawer />
		</div>
	</header>
</template>

<script setup lang="ts">
const props = defineProps({
	sidebarVisible: {
		type: Boolean,
		default: false
	},
})
const emit = defineEmits<{
	(e: 'open-right-drawer'): void,
	(e: 'open-left-drawer'): void
}>()

function openLeftDrawer() {
	emit('open-left-drawer');
}
</script>

<style scoped lang="scss">
.cwg-pc-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	width: 100vw;
	height: px2rpx(55);
	background-color: rgba(255, 255, 255, 0.9);
	border-bottom: 1px solid #f0f0f0;
	padding: 0 px2rpx(16);
	box-sizing: border-box;
	position: fixed;
	top: 0;
	left: 0;
	z-index: 101;
}

.left {
	display: flex;
	align-items: center;
}

.back-arrow {
	color: #e74c3c;
	font-size: 22px;
	cursor: pointer;
	margin-right: 16px;
}

.center {
	flex: 1;
}

.right {
	display: flex;
	align-items: center;
}

.bell .dot {
	position: absolute;
	top: 0;
	right: -2px;
	width: 7px;
	height: 7px;
	background: #27ae60;
	border-radius: 50%;
	display: inline-block;
}

.left-img {
	width: px2rpx(120);
}

.avatar .img {
	width: 32px;
	height: 32px;
	border-radius: 50%;
	background: #eee;
}

.logo .img {
	width: 36px;
	height: 36px;
	border-radius: 50%;
	background: #fff;
}
</style>
