Chase AdamsChase Adams
AboutContentPromptsPlayground

Box util for Stitches CSS in JS

Box util for Stitches CSS in JS

Box util for Stitches CSS in JS

Essays and updates on product, engineering, and AI by Chase Adams.

1 minute read

I had a specific border I wanted to use consistently in my web design, so I made a util for Stitches (styling) that took the position the border needed to be in and did the work of styling the border for light and dark mode.

createStitches({
  utils: {
	  box: (sides: Array<"top" | "left" | "bottom" | "right">) =>
	      (sides.length ? sides : sidesOptions).reduce<{
	        [k: string]: string;
	      }>((prevVal, side) => {
	        prevVal[`border-${side}`] = "1px dashed $gray200";
	        if (!prevVal[`.${darkTheme} &`]) {
	          // @ts-ignore
	          prevVal[`.${darkTheme} &`] = {};
	        }
	        // @ts-ignore
	        prevVal[`.${darkTheme} &`][`border-${side}`] = "1px dashed $gray800";
	        return prevVal;
	      }, {}),
	},
});
First Cohort
No Coding Experience Required

Build Your Website with AI—No Code Required

Learn to create and deploy professional websites using ChatGPT and Claude. Go from complete beginner to confident website builder.

Start Building Today

Post Details

Published
Jan 24, 2023
Share
Ask ChatGPT
Ask Claude

Latest Posts

Joining Rocket Money as VP of AI Engineering

Joining Rocket Money as VP of AI Engineering

Leading AI engineering at Rocket Money to write the playbook for how engineering teams operate in the AI era

Ask me anything

Loading...

Hi! Ask me anything about Chase's work.

I can answer questions based on his blog posts and articles.

Experimental: This chat is a side project I work on in my free time. Responses may vary in quality and accuracy.

AboutAI Workflow SpecContentStacksNewsletterPromptsRSS