[WV2] Move species color picker into outfit area
This commit is contained in:
parent
0651a2871c
commit
2dc5505147
2 changed files with 83 additions and 51 deletions
|
|
@ -40,6 +40,76 @@ body.wardrobe-v2 {
|
||||||
padding: 2rem;
|
padding: 2rem;
|
||||||
font-size: 1.2rem;
|
font-size: 1.2rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Species/color picker floats over the preview at the bottom */
|
||||||
|
species-color-picker {
|
||||||
|
position: absolute;
|
||||||
|
bottom: 0;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
padding: 1.5rem;
|
||||||
|
pointer-events: none;
|
||||||
|
/* Allow clicks through when hidden */
|
||||||
|
|
||||||
|
/* Start hidden, reveal on hover or focus */
|
||||||
|
opacity: 0;
|
||||||
|
transition: opacity 0.2s;
|
||||||
|
|
||||||
|
form {
|
||||||
|
display: flex;
|
||||||
|
gap: 0.5rem;
|
||||||
|
pointer-events: auto;
|
||||||
|
/* Re-enable clicks on the form itself */
|
||||||
|
}
|
||||||
|
|
||||||
|
select {
|
||||||
|
padding: 0.5rem 2rem 0.5rem 0.75rem;
|
||||||
|
font-size: 1rem;
|
||||||
|
border: 1px solid rgba(255, 255, 255, 0.3);
|
||||||
|
border-radius: 0.375rem;
|
||||||
|
background: rgba(0, 0, 0, 0.7);
|
||||||
|
color: white;
|
||||||
|
cursor: pointer;
|
||||||
|
backdrop-filter: blur(8px);
|
||||||
|
-webkit-backdrop-filter: blur(8px);
|
||||||
|
appearance: none;
|
||||||
|
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3E%3Cpath stroke='%23fff' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3E%3C/svg%3E");
|
||||||
|
background-position: right 0.5rem center;
|
||||||
|
background-repeat: no-repeat;
|
||||||
|
background-size: 1.5em 1.5em;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
background-color: rgba(0, 0, 0, 0.8);
|
||||||
|
border-color: rgba(255, 255, 255, 0.5);
|
||||||
|
}
|
||||||
|
|
||||||
|
&:focus {
|
||||||
|
outline: none;
|
||||||
|
border-color: rgba(255, 255, 255, 0.8);
|
||||||
|
box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.1);
|
||||||
|
}
|
||||||
|
|
||||||
|
option {
|
||||||
|
background: #2D3748;
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Show picker on hover (real hover only, not simulated touch hover) */
|
||||||
|
@media (hover: hover) {
|
||||||
|
&:hover species-color-picker {
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Show picker when it has focus */
|
||||||
|
&:has(species-color-picker:focus-within) species-color-picker {
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.outfit-controls-section {
|
.outfit-controls-section {
|
||||||
|
|
@ -67,35 +137,6 @@ body.wardrobe-v2 {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.species-color-picker {
|
|
||||||
margin: 1.5rem 0;
|
|
||||||
|
|
||||||
.form-group {
|
|
||||||
margin-bottom: 1rem;
|
|
||||||
|
|
||||||
label {
|
|
||||||
display: block;
|
|
||||||
font-weight: bold;
|
|
||||||
margin-bottom: 0.5rem;
|
|
||||||
color: #333;
|
|
||||||
}
|
|
||||||
|
|
||||||
select {
|
|
||||||
width: 100%;
|
|
||||||
padding: 0.5rem;
|
|
||||||
font-size: 1rem;
|
|
||||||
border: 1px solid #ccc;
|
|
||||||
border-radius: 4px;
|
|
||||||
font-family: inherit;
|
|
||||||
|
|
||||||
&:focus {
|
|
||||||
outline: none;
|
|
||||||
border-color: #448844;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.current-selection {
|
.current-selection {
|
||||||
padding: 1rem;
|
padding: 1rem;
|
||||||
background: #f0f0f0;
|
background: #f0f0f0;
|
||||||
|
|
|
||||||
|
|
@ -27,35 +27,26 @@
|
||||||
- else
|
- else
|
||||||
= outfit_viewer @outfit
|
= outfit_viewer @outfit
|
||||||
|
|
||||||
.outfit-controls-section
|
%species-color-picker
|
||||||
%h1 Customize your pet
|
|
||||||
|
|
||||||
.species-color-picker
|
|
||||||
= form_with url: wardrobe_v2_path, method: :get do |f|
|
= form_with url: wardrobe_v2_path, method: :get do |f|
|
||||||
.form-group
|
= select_tag :color,
|
||||||
= label_tag :species, "Species:"
|
options_from_collection_for_select(@colors, "id", "human_name",
|
||||||
= select_tag :species,
|
@selected_color&.id),
|
||||||
options_from_collection_for_select(@species, "id", "human_name",
|
onchange: "this.form.requestSubmit()",
|
||||||
@selected_species&.id),
|
"aria-label": "Pet color"
|
||||||
onchange: "this.form.requestSubmit()"
|
= select_tag :species,
|
||||||
|
options_from_collection_for_select(@species, "id", "human_name",
|
||||||
.form-group
|
@selected_species&.id),
|
||||||
= label_tag :color, "Color:"
|
onchange: "this.form.requestSubmit()",
|
||||||
= select_tag :color,
|
"aria-label": "Pet species"
|
||||||
options_from_collection_for_select(@colors, "id", "human_name",
|
|
||||||
@selected_color&.id),
|
|
||||||
onchange: "this.form.requestSubmit()"
|
|
||||||
|
|
||||||
-# Preserve item IDs in the URL
|
-# Preserve item IDs in the URL
|
||||||
- if params[:objects].present?
|
- if params[:objects].present?
|
||||||
- params[:objects].each do |item_id|
|
- params[:objects].each do |item_id|
|
||||||
= hidden_field_tag "objects[]", item_id
|
= hidden_field_tag "objects[]", item_id
|
||||||
|
|
||||||
- if @outfit.pet_state
|
.outfit-controls-section
|
||||||
.current-selection
|
%h1 Customize your pet
|
||||||
%p
|
|
||||||
Currently showing:
|
|
||||||
%strong= "#{@selected_color.human_name} #{@selected_species.human_name}"
|
|
||||||
|
|
||||||
- if @outfit.worn_items.any?
|
- if @outfit.worn_items.any?
|
||||||
.worn-items
|
.worn-items
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue