mirror of
https://github.com/usetrmnl/terminus.git
synced 2026-04-29 13:34:37 -07:00
efe820d76d
This information is provided via the TRMNL API which means we can now dynamically apply density for the model used. Milestone: minor
19 lines
464 B
Ruby
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
|