Skip to content

Instantly share code, notes, and snippets.

View segunadebayo's full-sized avatar
😃

Segun Adebayo segunadebayo

😃
View GitHub Profile
@segunadebayo
segunadebayo / cli.md
Last active June 21, 2024 16:35
chakra-v3-proposal

CLI ideas

chakra compose

This command will allow you import component compositions into your project.

By default, it'll import all component compositions.

## add a specific component
@segunadebayo
segunadebayo / base.ts
Last active April 13, 2024 22:34
vanilla-extract
import { defineProperties, createSprinkles } from '@vanilla-extract/sprinkles'
const typographyProperties = defineProperties({
...responsiveProperties,
properties: {
fontSize: fontSizePairings,
lineHeight: lineHeights,
fontWeight: fontWeights,
letterSpacing: letterSpacings,
textAlign: ['left', 'right', 'center'],
@segunadebayo
segunadebayo / external.mdx
Last active March 25, 2024 13:30
zag: virtualized select
const items = ['React', 'Solid', 'Vue']

const Basic = () => {
  const contentRef = useRef(null)

  const api = useVirtualizer({
    count: items.length,
    getScrollElement: () => contentRef.current,
    estimateSize: () => 35,
@segunadebayo
segunadebayo / txt.md
Created April 14, 2023 19:26
webpack-plugin.md
const childProcess = require('child_process')
// gaze是用于监听文件变化的工具
const Gaze = require('gaze');
// 有更友好展示的console
const consola = require('consola')

class MyPlugin {
  // 将 `apply` 定义为其原型方法,此方法以 compiler 作为参数
  apply(compiler) {
@segunadebayo
segunadebayo / use-cursor.ts
Created January 10, 2023 18:38
Restore Cursor
import { useRef } from "react";
import warning from "rc-util/lib/warning";
/**
* Keep input cursor in the correct position if possible.
* Is this necessary since we have `formatter` which may mass the content?
*/
export default function useCursor(
input: HTMLInputElement,
focused: boolean
): [() => void, () => void] {
@segunadebayo
segunadebayo / discord.ts
Created January 2, 2023 12:18
Post to Discord with JS
import fs from "fs"
import Discord from "discord.js"
import { config } from "dotenv"
import ora from "ora"
import { outdent } from "outdent"
config()
const CHANNELS = {
ANNOUNCEMENT: process.env.CHANNEL_ID,
@segunadebayo
segunadebayo / tabs.theme.ts
Created December 30, 2022 10:28
Chakra Tabs - With Indicator
const variants = {
'with-indicator': definePartsStyle((props) => {
const sizes = {
md: {
tablist: {
h: 11,
px: 1,
},
tab: {
fontSize: 'sm',
/* Non-atomic */

.css-Box {
  background: red;
  font-size: 10px;
}

.css-Tab {
 background: red;

Assets

Rename assets to chunks

A chunk will look like this

const file = {
  base: ``,
  utilities: ``,
@segunadebayo
segunadebayo / lang.md
Created September 27, 2022 15:34
Template Lang
const settings = {
  primaryColor: "#red",
  font: "UI Big",
};

const content = {
  hero: {
    title: "Expert homeschooling service",
 desc: "Keep your kids learning at home with online or in-person lessons taught by exceptional teachers",