Skip to content
Open
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
53 changes: 42 additions & 11 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,37 @@ module.exports = {
'plugin:storybook/recommended',
'prettier',
],
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaFeatures: {
jsx: true,
overrides: [
{
files: ['*.ts', '*.tsx'],
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaFeatures: {
jsx: true,
},
ecmaVersion: 'latest',
sourceType: 'module',
project: [
'./tsconfig.json',
'./docs/tsconfig.json',
'./examples/tsconfig.json'
],
tsconfigRootDir: __dirname,
warnOnUnsupportedTypeScriptVersion: false
},
},
ecmaVersion: 'latest',
sourceType: 'module',
project: './tsconfig.json',
tsconfigRootDir: __dirname,
warnOnUnsupportedTypeScriptVersion: false
},
{
files: ['*.js', '*.jsx', '*.cjs', '*.mjs'],
parser: '@babel/eslint-parser',
parserOptions: {
ecmaFeatures: {
jsx: true,
},
ecmaVersion: 'latest',
sourceType: 'module',
},
},
],
plugins: [
'react',
'react-hooks',
Expand All @@ -48,5 +68,16 @@ module.exports = {
'@typescript-eslint/no-unused-expressions': 'warn',
'jsx-a11y/media-has-caption': 'off', // We've implemented captions in our media components
},
ignorePatterns: ['dist', 'node_modules', 'storybook-static'],
ignorePatterns: [
'dist',
'node_modules',
'storybook-static',
'*.config.js',
'*.config.ts',
'postcss.config.js',
'tailwind.config.js',
'vite.config.ts',
'vitest.config.ts',
'tsup.config.ts',
],
};
16 changes: 16 additions & 0 deletions docs/.storybook/preview.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import type { Preview } from '@storybook/react';
import '../styles.css';

const preview: Preview = {
parameters: {
actions: { argTypesRegex: '^on[A-Z].*' },
controls: {
matchers: {
color: /(background|color)$/i,
date: /Date$/,
},
},
},
};

export default preview;
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
import type { Meta, StoryObj } from '@storybook/react';
import { PromptContainerFullLineBottomActions } from '@/blocks/prompt/PromptContainerFullLineBottomActions';
import { Button } from '@/components/ui/button';
import { Paperclip, Mic, Send } from 'lucide-react';

const meta: Meta<typeof PromptContainerFullLineBottomActions> = {
title: 'Blocks/Prompt/PromptContainerFullLineBottomActions',
component: PromptContainerFullLineBottomActions,
parameters: {
layout: 'centered',
},
tags: ['autodocs'],
};

export default meta;
type Story = StoryObj<typeof PromptContainerFullLineBottomActions>;

const defaultActionButtons = (
<>
<Button variant="ghost" size="icon" aria-label="Attach file">
<Paperclip className="h-4 w-4" />
</Button>
<Button variant="ghost" size="icon" aria-label="Use microphone">
<Mic className="h-4 w-4" />
</Button>
<Button variant="ghost" size="icon" aria-label="Send message">
<Send className="h-4 w-4" />
</Button>
</>
);

export const Default: Story = {
args: {
placeholder: 'Type your message...',
actionButtons: defaultActionButtons,
},
};

export const WithValue: Story = {
args: {
value: 'This is a sample message',
actionButtons: defaultActionButtons,
},
};

export const Disabled: Story = {
args: {
disabled: true,
value: 'This input is disabled',
actionButtons: defaultActionButtons,
},
};

export const CustomActionButtons: Story = {
args: {
actionButtons: (
<>
<Button variant="ghost" size="icon" aria-label="Custom action 1">
<Paperclip className="h-4 w-4" />
</Button>
<Button variant="ghost" size="icon" aria-label="Custom action 2">
<Mic className="h-4 w-4" />
</Button>
</>
),
},
};
11 changes: 11 additions & 0 deletions docs/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"extends": "../tsconfig.json",
"compilerOptions": {
"jsx": "react-jsx",
"baseUrl": ".",
"paths": {
"@/*": ["../src/*"]
}
},
"include": ["stories/**/*", ".storybook/**/*"]
}
8 changes: 5 additions & 3 deletions examples/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
{
"extends": "../tsconfig.json",
"compilerOptions": {
"jsx": "react-jsx",
"baseUrl": ".",
"paths": {
"@/*": ["../src/*"]
}
},
"include": ["./**/*.ts", "./**/*.tsx", "./typings.d.ts"],
"references": [{ "path": "../tsconfig.node.json" }]
"include": [
"./**/*.ts",
"./**/*.tsx",
"./**/*.d.ts"
]
}
Loading