I am creating a select dropdown like a material UI dropdown, there I have added an appearance like an arrow up and arrow down icon, so I need that the arrow up only happens when the dropdown is shown otherwise the arrow down icon. If I am clicking on the dropdown, the arrow up is coming, but again if you click then the dropdown is not present, at that time I need the functionality of the arrow down. How can I make this happen?
<select className="Select">
<option value="">Select</option>
<option value="1">Option 1</option>
<option value="2">Option 2</option>
<option value="3">Option 3</option>
<option value="4">Option 4</option>
</select>
css code
.Select {
font-size: 1.5rem;
width: 10rem;
border-left: none;
border-right: none;
border-top: none;
border-bottom: 2px solid blue;
padding-bottom: 2px;
color: var(--deepGray);
background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-chevron-down" viewBox="0 0 16 16"><path fill-rule="evenodd" d="M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z"/></svg>')
no-repeat right;
-webkit-appearance: none;
}
.Select:hover {
color: blue;
background: white;
background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-chevron-down" viewBox="0 0 16 16"><path fill-rule="evenodd" d="M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z"/></svg>')
no-repeat right;
}
.Select:focus {
outline: none;
box-shadow: none;
background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-chevron-up" viewBox="0 0 16 16"><path fill-rule="evenodd" d="M7.646 4.646a.5.5 0 0 1 .708 0l6 6a.5.5 0 0 1-.708.708L8 5.707l-5.646 5.647a.5.5 0 0 1-.708-.708l6-6z"/></svg>')
no-repeat right;
background-position: right;
}