Write on the margins of the internet. Powered by the AT Protocol.
margin.at
extension
web
atproto
comments
1import { atom } from "nanostores";
2
3export type FeedLayout = "list" | "mosaic";
4
5const STORAGE_KEY = "margin:feed-layout";
6
7function getInitial(): FeedLayout {
8 if (typeof window === "undefined") return "list";
9 const stored = localStorage.getItem(STORAGE_KEY);
10 if (stored === "mosaic") return "mosaic";
11 return "list";
12}
13
14export const $feedLayout = atom<FeedLayout>(getInitial());
15
16export function setFeedLayout(layout: FeedLayout) {
17 $feedLayout.set(layout);
18 localStorage.setItem(STORAGE_KEY, layout);
19}