From e8e2ab2baaf8610bc91790779e232108ccc35bc9 Mon Sep 17 00:00:00 2001 From: Valentin Reynoso Date: Thu, 25 Jan 2024 12:53:10 -0300 Subject: [PATCH] style: fix responsiveness on mobile resolutions --- .../vaadin/addons/dayofweekselector/DayOfWeekSelector.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/main/java/com/flowingcode/vaadin/addons/dayofweekselector/DayOfWeekSelector.java b/src/main/java/com/flowingcode/vaadin/addons/dayofweekselector/DayOfWeekSelector.java index ce8b2e6..414ef59 100644 --- a/src/main/java/com/flowingcode/vaadin/addons/dayofweekselector/DayOfWeekSelector.java +++ b/src/main/java/com/flowingcode/vaadin/addons/dayofweekselector/DayOfWeekSelector.java @@ -24,6 +24,7 @@ import com.vaadin.flow.component.customfield.CustomField; import com.vaadin.flow.component.datepicker.DatePicker.DatePickerI18n; import com.vaadin.flow.component.dependency.CssImport; +import com.vaadin.flow.component.orderedlayout.FlexComponent.JustifyContentMode; import com.vaadin.flow.component.orderedlayout.HorizontalLayout; import java.time.DayOfWeek; import java.util.Arrays; @@ -81,6 +82,7 @@ private void setState(boolean state) { */ public DayOfWeekSelector() { getStyle().set("padding", "var(--lumo-space-m)"); + getStyle().set("width", "100%"); buttonsLayout = new HorizontalLayout(); buttonsLayout.add(new DayOfWeekButton(DayOfWeek.SUNDAY, "S")); @@ -91,6 +93,11 @@ public DayOfWeekSelector() { buttonsLayout.add(new DayOfWeekButton(DayOfWeek.FRIDAY, "F")); buttonsLayout.add(new DayOfWeekButton(DayOfWeek.SATURDAY, "S")); + buttonsLayout.setWidthFull(); + buttonsLayout.setJustifyContentMode(JustifyContentMode.CENTER); + buttonsLayout.getStyle().set("flex-wrap", "wrap"); + buttonsLayout.getStyle().set("padding", "0 10px 0 10px"); + getButtons().forEach(button -> button.addClickListener(ev -> updateValue())); add(buttonsLayout); clear();