aboutsummaryrefslogtreecommitdiff
path: root/src/lib.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib.ts')
-rw-r--r--src/lib.ts12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/lib.ts b/src/lib.ts
index a6c8df1..19bd864 100644
--- a/src/lib.ts
+++ b/src/lib.ts
@@ -47,6 +47,18 @@ export type Action =
* General utility functions
*/
+export type Breakpoint = 'sm' | 'md' | 'lg'; // These represent screen sizes
+export function getBreakpoint(): Breakpoint {
+ let w = window.innerWidth;
+ if (w < 768){
+ return 'sm';
+ } else if (w < 1024){
+ return 'md';
+ } else {
+ return 'lg';
+ }
+}
+
// Returns [0 ... len]
export function range(len: number): number[] {
return [...Array(len).keys()];