Skip to content

Commit 589515e

Browse files
authored
feat: AiChat component styles (#49)
1 parent 242151f commit 589515e

File tree

20 files changed

+235
-155
lines changed

20 files changed

+235
-155
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
"typecheck": "tsc --noEmit",
1818
"build:esm": "tsc",
1919
"build:cjs": "tsc --module commonjs --outDir dist/cjs",
20-
"build:static": "cp -r ./static dist/static",
2120
"build:bundles": "vite build --outDir dist/bundles",
2221
"build:type-augmentation": "cp -r src/type-augmentation dist/type-augmentation",
2322
"build": "./scripts/build.sh",
@@ -99,6 +98,7 @@
9998
"@testing-library/user-event": "14.6.1",
10099
"@types/jest": "^29.5.14",
101100
"@types/lodash": "^4.17.13",
101+
"@types/react": "^19.0.8",
102102
"@types/react-dom": "^19.0.0",
103103
"@typescript-eslint/eslint-plugin": "^8.13.0",
104104
"@typescript-eslint/typescript-estree": "^8.13.0",

scripts/build.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,4 @@ rm -rf dist &&
66
npm run build:esm &&
77
npm run build:cjs &&
88
npm run build:type-augmentation &&
9-
npm run build:static &&
109
npm run build:bundles

src/ai.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
export { AiChat } from "./components/AiChat/AiChat"
22
export type { AiChatProps } from "./components/AiChat/AiChat"
3+
export type { AiChatMessage } from "./components/AiChat/types"

src/components/AiChat/AiChat.stories.tsx

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,15 @@ const INITIAL_MESSAGES: AiChatProps["initialMessages"] = [
1414
content: "Hi! What are you interested in learning about?",
1515
role: "assistant",
1616
},
17+
{
18+
content: "I need to brush up on my Calculus",
19+
role: "user",
20+
},
21+
{
22+
content:
23+
"Great! Do you want to start with the basics, like limits and derivatives, or jump into more advanced topics like integrals and series? Let me know how I can help!",
24+
role: "assistant",
25+
},
1726
]
1827

1928
const STARTERS = [
@@ -24,7 +33,7 @@ const STARTERS = [
2433

2534
const Container = styled.div({
2635
width: "100%",
27-
height: "500px",
36+
height: "800px",
2837
})
2938

3039
const meta: Meta<typeof AiChat> = {
@@ -42,7 +51,7 @@ const meta: Meta<typeof AiChat> = {
4251
initialMessages: INITIAL_MESSAGES,
4352
requestOpts: { apiUrl: TEST_API_STREAMING },
4453
conversationStarters: STARTERS,
45-
title: "Chat with AI",
54+
askTimTitle: "to recommend a course",
4655
onClose: fn(),
4756
},
4857
argTypes: {
@@ -82,6 +91,7 @@ export const StreamingResponses: Story = {}
8291
*/
8392
export const JsonResponses: Story = {
8493
args: {
94+
title: "Chat with AI",
8595
requestOpts: { apiUrl: TEST_API_JSON },
8696
parseContent: (content: unknown) => {
8797
return JSON.parse(content as string).message

src/components/AiChat/AiChat.test.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ describe("AiChat", () => {
6666
initialMessages={initialMessages}
6767
conversationStarters={conversationStarters}
6868
requestOpts={{ apiUrl: "http://localhost:4567/test" }}
69+
placeholder="Type a message..."
6970
{...props}
7071
/>,
7172
{ wrapper: ThemeProvider },

0 commit comments

Comments
 (0)