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

Input Component #5

Merged
merged 12 commits into from
Dec 9, 2023
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
8 changes: 8 additions & 0 deletions .storybook/manager.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// .storybook/manager.js

import { addons } from '@storybook/manager-api';
import theme from './theme';

addons.setConfig({
theme: theme
});
7 changes: 7 additions & 0 deletions .storybook/preview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@ import type { Preview } from "@storybook/react";

const preview: Preview = {
parameters: {
backgrounds: {
default: 'code0',
values: [
{name: 'code0', value: '#030014'}
],
},
layout: 'centered',
actions: { argTypesRegex: "^on[A-Z].*" },
controls: {
matchers: {
Expand Down
43 changes: 43 additions & 0 deletions .storybook/theme.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
// .storybook/YourTheme.js

import { create } from '@storybook/theming/create';

export default create({
base: 'dark',
// Typography
fontBase: '"Ubuntu", sans-serif',
fontCode: 'monospace',

brandTitle: 'Code0 Base UI',
brandUrl: 'https://code0.tech',
brandImage: 'https://cdn.discordapp.com/attachments/1173726744130375791/1176472242469740604/Logo.png',
nicosammito marked this conversation as resolved.
Show resolved Hide resolved
brandTarget: '_self',

// UI
colorPrimary: '#70ffb2',
colorSecondary: '#70ffb2',
appBg: '#030014',
booleanBg: "rgba(255,255,255, .1)",
appContentBg: '#030014',
appBorderColor: '#91949A',
borderBottomColor: '91949A',
borderLeftColor: '91949A',
borderRightColor: '91949A',
borderTopColor: '91949A',
appBorderRadius: 0,

// Text colors
textColor: '#ffffff',
textInverseColor: '#ffffff',

// Toolbar default and active colors
barTextColor: 'rgba(255,255,255, .5)',
barSelectedColor: 'rgba(255,255,255, .75)',
barBg: '#030014',

// Form colors
inputBg: 'rgba(255,255,255, .1)',
inputBorder: '#91949A',
inputTextColor: 'rgba(255,255,255, .5)',
inputBorderRadius: 2,
});
35 changes: 33 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@code0-tech/base-ui",
"version": "0.0.0",
"version": "0.1.0-pre-alpha",
nicosammito marked this conversation as resolved.
Show resolved Hide resolved
"description": "A simple template for a custom React component library",
"scripts": {
"dev": "npm run storybook:dev",
Expand All @@ -27,9 +27,12 @@
"@storybook/addon-onboarding": "^1.0.8",
"@storybook/blocks": "^7.5.3",
"@storybook/cli": "^7.5.3",
"@storybook/manager-api": "^7.5.3",
"@storybook/react": "^7.5.3",
"@storybook/react-vite": "^7.5.3",
"@storybook/testing-library": "^0.2.2",
"@storybook/theming": "^7.5.3",
"@tabler/icons-react": "^2.42.0",
"@types/react": "^18.0.15",
"babel-loader": "^8.2.3",
"concurrently": "^8.2.2",
Expand Down
39 changes: 39 additions & 0 deletions src/components/input/Input.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import React, {useEffect, useRef} from "react";
import Input from "./Input";
import {IconMail} from "@tabler/icons-react";

export default {
title: "Input",
component: Input
};

export const Mail = () => <Input>
nicosammito marked this conversation as resolved.
Show resolved Hide resolved
<Input.Label>e-mail</Input.Label>
<Input.Control placeholder={"[email protected]"}/>
<Input.Desc>Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam</Input.Desc>
</Input>


export const Disabled = () => <Input disabled>
<Input.Control placeholder={"Your Mail"}>
<Input.Control.Icon><IconMail/></Input.Control.Icon>
</Input.Control>
<Input.Desc>Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam</Input.Desc>
</Input>

export const NotValid = () => <Input valid={false}>
<Input.Control placeholder={"Your E-Mail"}>
<Input.Control.Icon><IconMail/></Input.Control.Icon>
<Input.Control.Message>Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor
invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.</Input.Control.Message>
</Input.Control>
<Input.Desc>Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam</Input.Desc>
</Input>

export const Valid = () => <Input valid>
<Input.Control placeholder={"Your E-Mail"}>
<Input.Control.Message>Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor
invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.</Input.Control.Message>
</Input.Control>
<Input.Desc>Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam</Input.Desc>
</Input>
Loading