package miaou-core

  1. Overview
  2. Docs
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source

Source file responsive.ml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
(*****************************************************************************)
(*                                                                           *)
(* SPDX-License-Identifier: MIT                                              *)
(* Copyright (c) 2026 Nomadic Labs <contact@nomadic-labs.com>                *)
(*                                                                           *)
(*****************************************************************************)

type 'a breakpoint = {max_width : int; layout : 'a}

let pick breakpoints ~default ~width =
  let rec walk = function
    | [] -> default
    | bp :: rest -> if width <= bp.max_width then bp.layout else walk rest
  in
  walk breakpoints

let () =
  Miaou_registry.register ~name:"responsive" ~mli:[%blob "responsive.mli"] ()