Files
Brooke Kuhlmann efe820d76d Updated model struct to include CSS density class
This information is provided via the TRMNL API which means we can now dynamically apply density for the model used.

Milestone: minor
2026-04-01 14:06:15 -06:00

19 lines
464 B
Ruby

# frozen_string_literal: true
module Terminus
module Structs
# The model struct.
class Model < DB::Struct
def css_classes
size = css.dig "classes", "size"
density = css.dig "classes", "density"
"screen screen--#{name} screen--#{bit_depth}bit screen--#{orientation} " \
"#{size} screen--1x #{density}".strip.squeeze " "
end
def orientation = rotation.zero? ? "landscape" : "portrait"
end
end
end