refactor: enhance TimerPage layout and functionality; update theme and tokens for improved design consistency
- Refactored TimerPage component to improve layout and user experience. - Updated theme configuration to utilize design tokens for better maintainability. - Introduced new tokens for colors and typography to align with design principles. - Simplified state management and improved timer functionality. - Enhanced accessibility and responsiveness of UI elements.
This commit is contained in:
84 files changed
+4501
-2682
No files matched your search
@@ -0,0 +1,53 @@
|
||||
"""The mini timer's corner geometry.
|
||||
|
||||
A pure function, so it is worth pinning down: this is the sort of arithmetic
|
||||
that silently puts a window half off the screen on somebody else's monitor.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import pytest
|
||||
|
||||
from kadence_desktop.integrations.placement import CORNER_LABELS, CORNERS, Rect, point_for
|
||||
|
||||
SCREEN = Rect(0, 0, 1536, 960)
|
||||
SIZE = (252, 152)
|
||||
|
||||
|
||||
def test_each_corner_lands_where_its_name_says():
|
||||
assert point_for("top-left", SCREEN, SIZE, 24) == (24, 24)
|
||||
assert point_for("top-right", SCREEN, SIZE, 24) == (1260, 24)
|
||||
assert point_for("bottom-left", SCREEN, SIZE, 24) == (24, 784)
|
||||
assert point_for("bottom-right", SCREEN, SIZE, 24) == (1260, 784)
|
||||
|
||||
|
||||
def test_edge_centres_and_centre_are_centred():
|
||||
centre_x = (1536 - 252) // 2
|
||||
assert point_for("top-centre", SCREEN, SIZE, 24) == (centre_x, 24)
|
||||
assert point_for("bottom-centre", SCREEN, SIZE, 24) == (centre_x, 784)
|
||||
assert point_for("centre", SCREEN, SIZE, 24) == (centre_x, (960 - 152) // 2)
|
||||
|
||||
|
||||
def test_a_margin_of_zero_hugs_the_edge():
|
||||
assert point_for("bottom-right", SCREEN, SIZE, 0) == (1536 - 252, 960 - 152)
|
||||
|
||||
|
||||
def test_the_screen_offset_is_respected_on_a_second_monitor():
|
||||
"""A monitor to the right of the primary one starts at a non-zero x."""
|
||||
second = Rect(1536, 0, 1920, 1080)
|
||||
assert point_for("top-right", second, SIZE, 24) == (1536 + 1920 - 252 - 24, 24)
|
||||
assert point_for("bottom-left", second, SIZE, 24) == (1536 + 24, 1080 - 152 - 24)
|
||||
|
||||
|
||||
@pytest.mark.parametrize("corner", [c for c in CORNERS if c != "remember"])
|
||||
def test_the_window_never_leaves_the_screen(corner):
|
||||
"""Even on a screen smaller than the window, or with a silly margin."""
|
||||
tiny = Rect(0, 0, 200, 120)
|
||||
x, y = point_for(corner, tiny, SIZE, 400)
|
||||
assert x >= tiny.x and y >= tiny.y
|
||||
assert x <= tiny.x + max(tiny.width - SIZE[0], 0)
|
||||
assert y <= tiny.y + max(tiny.height - SIZE[1], 0)
|
||||
|
||||
|
||||
def test_every_corner_has_a_label_for_the_settings_page():
|
||||
assert set(CORNER_LABELS) == set(CORNERS)
|
||||
Reference in new issue
Block a user