Code Monkey home page Code Monkey logo

astro-sarkara's Introduction

Astro Sarkara

Astro components and layout package built with Panda CSS.

npm version Netlify Status

Demo
https://cieloazul310.github.io/astro-sarkara

Astro
https://astro.build/

Panda CSS
https://panda-css.com/

Getting started with the template

npm create astro@latest -- --template cieloazul310/astro-sarkara-starter

Getting started with an empty project

1. Create Astro project

npm create astro@latest

https://docs.astro.build/ja/getting-started/

2. Install Panda CSS and configure

npm install -D @pandacss/dev @pandacss/astro
npx panda init
// astro.config.ts
import { defineConfig } from 'astro/config';
import pandacss from '@pandacss/astro';
 
export default defineConfig({
  integrations: [pandacss()],
});
{
  "scripts": {
    "prepare": "panda codegen",
  }
}

https://panda-css.com/docs/installation/astro

3. Add astro-sarkara and configure

npm install @cieloazul310/astro-sarkara
// panda.config.ts
import { defineSarkaraConfig } from "@cieloazul310/astro-sarkara/preset";

export default defineSarkaraConfig({
  palette: { primary: "teal", secondary: "yellow" },
  include: ["./src/**/*.{js,jsx,ts,tsx,astro,mdx}"],
  
  // ...pandaConfig,
});

https://panda-css.com/docs/references/config

4. Codegen

rm -rf styled-system
npm run prepare

Usage

Layout

---
// src/pages/index.astro
import { defineSiteMetadata, SarkaraLayout } from "@cieloazul310/astro-sarkara";

const siteMetadata = defineSiteMetadata({
  title: "Site title",
  description: "Site description",
});
---
<SarkaraLayout siteMetadata={siteMetadata}>
  <!-- contents -->
</SarkaraLayout>

Components

---
// src/pages/index.astro
import { 
  defineSiteMetadata, 
  SarkaraLayout, 
  Paper,
} from "@cieloazul310/astro-sarkara";
import { css } from "@cieloazul310/sarkara-css";

const siteMetadata = defineSiteMetadata({
  title: "Site title",
  description: "Site description",
});
---
<SarkaraLayout siteMetadata={siteMetadata}>
  <Paper>
    <p class={css({ fontSize: "xl" })}>Hello, Astro</p>
  </Paper>
</SarkaraLayout>

Configure panda.config.ts

1. Using defineSarkaraConfig

// import { defineConfig } from "@pandacss/dev";
import {
  defineSarkaraConfig,
  // createSarkaraPreset,
  // astroComponentsPaths,
} from "@cieloazul310/astro-sarkara/preset";

export default defineSarkaraConfig({
  palette: { primary: "teal", secondary: "yellow" },
  include: ["./src/**/*.{js,jsx,ts,tsx,astro,mdx}"],
  
  // ...pandaConfig,
});

/* equivalent to
export default defineConfig({
  presets: [
    "@pandacss/dev/presets",
    createSarkaraPreset({ palette: { primary: "teal", secondary: "yellow" } }),
  ],

  include: ["./src/**/*.{js,ts,astro}", ...astroComponentsPaths],

  outdir: "@cieloazul310/sarkara-css",
  emitPackage: true,  
});
*/

https://panda-css.com/docs/references/config#presets

colors.primary and colors.secondary is required, and you can set any colors.

https://panda-css.com/docs/customization/theme#colors

primary: teal
secondary: yellow
danger: red

  primary.100 => teal.100
  secondary.600 => yellow.600
  danger.800 => red.800

emitPackage

Whether to emit the artifacts to node_modules as a package. Will generate a package.json file that contains exports for each of the the generated outdir entrypoints:

https://panda-css.com/docs/references/config#emitpackage

astro-sarkara's People

Contributors

cieloazul310 avatar dependabot[bot] avatar github-actions[bot] avatar

Stargazers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.