Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: update doc follow themes, update ink:theme classes #33

Merged
merged 1 commit into from
Nov 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions .storybook/preview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ const preview: Preview = {
decorators: [
withThemeByClassName<ReactRenderer>({
themes: {
light: "ink-light-theme",
dark: "ink-dark-theme",
contrast: "ink-contrast-theme",
neo: "ink-neo-theme",
morpheus: "ink-morpheus-theme",
light: "ink:light-theme",
dark: "ink:dark-theme",
contrast: "ink:contrast-theme",
neo: "ink:neo-theme",
morpheus: "ink:morpheus-theme",
},
defaultTheme: "light",
}),
Expand Down
67 changes: 52 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,8 @@
<img src="src/images/banner.png" alt="Inkkit Banner" style="width: 100%; border-radius: 8px; margin-bottom: 2rem;" />
<img src="src/images/banner.png" alt="Ink Kit Banner" style="width: 100%; border-radius: 8px; margin-bottom: 2rem;" />

# Inkkit
# Welcome to Ink Kit

Inkkit is an onchain-focused SDK that delivers a delightful developer experience with ready-to-use app layout templates, themes, and magical animated components.

## Features

- 🎨 Customizable app layout templates
- ✨ Magical animated components
- 🎭 Vibrant themes
- ⛓️ Onchain-focused development
- 🚀 Efficient developer experience
- 📱 Polished, engaging interfaces
Ink Kit is an onchain-focused SDK that delivers a delightful developer experience with ready-to-use app layout templates, themes, and magical animated components.

## Install

Expand Down Expand Up @@ -43,12 +34,58 @@ function App() {
}
```

Note: Inkkit classes are prefixed with `ink-` and can be customized using CSS variables instead of Tailwind classes. They should be imported first so that your own custom classes are taking precedence.
Note: Ink Kit classes are prefixed with `ink:` and can be customized using CSS variables instead of Tailwind classes. They should be imported first so that your own custom classes are taking precedence.

## Key Features

- 🎨 **Customizable app layout templates**
- ✨ **Magical animated components**
- 🎭 **Vibrant themes**
- ⛓️ **Onchain-focused development**
- 🚀 **Efficient developer experience**
- 📱 **Polished, engaging interfaces**

## Theming

By default, Ink Kit provides a couple of themes already in the stylesheet:

- Light (`light-theme`)
- Dark (`dark-theme`)
- Contrast (`contrast-theme`)
- Neo (`neo-theme`)
- Morpheus (`morpheus-theme`)

To specify which theme to use, add the `ink:THEME_ID` to your document root:

```tsx
<html class="ink:dark-theme">
...
```

If you want to programatically set this value, you can use the `useInkThemeClass`:

```tsx
const theme = getMyCurrentTheme();
useInkThemeClass(theme === "light" ? "ink:neo-theme" : "ink:dark-theme");
```

### Custom Theme

To create a custom theme, you can override CSS variables:

```css
:root {
--ink-button-primary: rgb(10, 55, 10);
...
}
```

To see examples on specific colors that you can override, check the following [theme](https://github.com/inkonchain/ink-kit/tree/main/src/styles/theme) section of the Ink Kit repository.

## Resources

- **Documentation**: Browse components and examples on our [Storybook page](https://inkkit.inkonchain.com/)
- **Contributing**: Open a PR right here on our [GitHub repository](https://github.com/inkonchain/ink-kit)
- **Documentation**: Visit our [Storybook](https://inkkit.inkonchain.com/)
- **Contributing**: Visit our [GitHub repository](https://github.com/inkonchain/ink-kit)

## WIP Notice

Expand Down
13 changes: 4 additions & 9 deletions src/hooks/useInkThemeClass.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,17 @@
import { useEffect } from "react";

const themeClasses = [
"ink-dark-theme",
"ink-light-theme",
"ink:contrast-theme",
"ink-neo-theme",
"ink-morpheus-theme",
] as const;
const themeClasses = ["dark", "light", "contrast", "neo", "morpheus"] as const;

export function useInkThemeClass(
theme: "default" | (typeof themeClasses)[number]
) {
useEffect(() => {
themeClasses.forEach((t) => {
const className = `ink:${t}-theme`;
if (theme === t) {
document.documentElement.classList.add(t);
document.documentElement.classList.add(className);
} else {
document.documentElement.classList.remove(t);
document.documentElement.classList.remove(className);
}
});
}, [theme]);
Expand Down
43 changes: 38 additions & 5 deletions src/stories/Welcome.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ import Banner from "../images/banner.webp?base64";

<img
src={Banner}
alt="Inkkit Banner"
alt="Ink Kit Banner"
style={{ width: "100%", marginBottom: "2rem", borderRadius: "8px" }}
/>

# Welcome to Inkkit
# Welcome to Ink Kit

Inkkit is an onchain-focused SDK that delivers a delightful developer experience with ready-to-use app layout templates, themes, and magical animated components.
Ink Kit is an onchain-focused SDK that delivers a delightful developer experience with ready-to-use app layout templates, themes, and magical animated components.

## Install

Expand Down Expand Up @@ -43,7 +43,7 @@ function App() {
}
```

Note: Inkkit classes are prefixed with `ink-` and can be customized using CSS variables instead of Tailwind classes. They should be imported first so that your own custom classes are taking precedence.
Note: Ink Kit classes are prefixed with `ink:` and can be customized using CSS variables instead of Tailwind classes. They should be imported first so that your own custom classes are taking precedence.

## Key Features

Expand All @@ -56,7 +56,40 @@ Note: Inkkit classes are prefixed with `ink-` and can be customized using CSS va

## Theming

Complete theming guide coming soon.
By default, Ink Kit provides a couple of themes already in the stylesheet:

- Light (`light-theme`)
- Dark (`dark-theme`)
- Contrast (`contrast-theme`)
- Neo (`neo-theme`)
- Morpheus (`morpheus-theme`)

To specify which theme to use, add the `ink:THEME_ID` to your document root:

```tsx
<html class="ink:dark-theme">
...
```

If you want to programatically set this value, you can use the `useInkThemeClass`:

```tsx
const theme = getMyCurrentTheme();
useInkThemeClass(theme === "light" ? "ink:neo-theme" : "ink:dark-theme");
```

### Custom Theme

To create a custom theme, you can override CSS variables:

```css
:root {
--ink-button-primary: rgb(10, 55, 10);
...
}
```

To see examples on specific colors that you can override, check the following [theme](https://github.com/inkonchain/ink-kit/tree/main/src/styles/theme) section of the Ink Kit repository.

## Resources

Expand Down
5 changes: 5 additions & 0 deletions src/styles/theme/colors.base.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/*
Colors in this file are automatically computed using the other variables.
You can override them in a theme if you need specific colors, but these should look good without it.
*/

:root {
/* Background */
--ink-background-dark-transparent: color-mix(
Expand Down
2 changes: 1 addition & 1 deletion src/styles/theme/colors.contrast.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
:root,
:root.ink-contrast-theme {
:root.ink\:contrast-theme {
/* Background */
--ink-background-dark: rgba(221, 221, 221, 1);
--ink-background-light: rgba(255, 255, 255, 1);
Expand Down
6 changes: 5 additions & 1 deletion src/styles/theme/colors.dark.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
:root,
:root.ink-dark-theme {
:root.ink\:dark-theme {
/* Background */
--ink-background-dark: rgb(22, 15, 31);
--ink-background-light: rgb(33, 26, 41);
Expand All @@ -19,6 +19,10 @@
--ink-status-error: rgb(236, 109, 109);
}

/*
This allow us to use the dark theme over the light theme by default, depending on user preference.
The overrides should _exactly_ match the variables above.
*/
@media (prefers-color-scheme: dark) {
:root {
/* Background */
Expand Down
2 changes: 1 addition & 1 deletion src/styles/theme/colors.light.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
:root,
:root.ink-light-theme {
:root.ink\:light-theme {
/* Background */
--ink-background-dark: rgb(240, 239, 255);
--ink-background-light: rgb(255, 255, 255);
Expand Down
2 changes: 1 addition & 1 deletion src/styles/theme/colors.morpheus.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
:root,
:root.ink-morpheus-theme {
:root.ink\:morpheus-theme {
/* Background */
--ink-background-dark: rgba(15, 13, 35, 1);
--ink-background-light: rgba(27, 23, 73, 1);
Expand Down
2 changes: 1 addition & 1 deletion src/styles/theme/colors.neo.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
:root,
:root.ink-neo-theme {
:root.ink\:neo-theme {
/* Background */
--ink-background-dark: rgb(7, 9, 8);
--ink-background-light: rgb(19, 28, 23);
Expand Down
Loading