Skip to content

Commit

Permalink
chore(components): fix storybook import of CSS and add card story (#273)
Browse files Browse the repository at this point in the history
  • Loading branch information
laurentlp authored Dec 3, 2021
1 parent 67906da commit 57d2b21
Show file tree
Hide file tree
Showing 5 changed files with 342 additions and 311 deletions.
14 changes: 7 additions & 7 deletions packages/components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@
},
"devDependencies": {
"@babel/core": "^7.15.8",
"@storybook/addon-essentials": "^6.4.3",
"@storybook/addon-links": "^6.4.3",
"@storybook/addon-measure": "^6.4.3",
"@storybook/components": "^6.4.3",
"@storybook/core-events": "^6.4.3",
"@storybook/react": "^6.4.3",
"@storybook/theming": "^6.4.3",
"@storybook/addon-essentials": "^6.4.4",
"@storybook/addon-links": "^6.4.4",
"@storybook/addon-measure": "^6.4.4",
"@storybook/components": "^6.4.4",
"@storybook/core-events": "^6.4.4",
"@storybook/react": "^6.4.4",
"@storybook/theming": "^6.4.4",
"@testing-library/dom": "^8.10.1",
"@testing-library/jest-dom": "^5.14.1",
"@testing-library/react": "^12.1.0",
Expand Down
1 change: 0 additions & 1 deletion packages/components/src/css/botpress-default.css
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,6 @@ body {
box-sizing: border-box;
color: rgba(0, 0, 0, 1);
line-height: 1.28em;
margin-right: 3px;
min-height: 150px;
max-height: 410px;
border: 1px solid rgba(0, 0, 0, 0.1);
Expand Down
32 changes: 32 additions & 0 deletions packages/components/story/card.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import { ComponentStory, ComponentMeta } from '@storybook/react'
import React from 'react'
import { Card } from '../src/renderer/carousel'
import { defaultMessageConfig } from '../src/utils'

export default {
title: 'Card',
component: Card
} as ComponentMeta<typeof Card>

const Template: ComponentStory<typeof Card> = (args) => <Card {...args} />

export const Primary = Template.bind({})

Primary.args = {
title: 'Card 1',
subtitle: 'Subtitle 1',
image: 'https://via.placeholder.com/150/150',
actions: [
{
title: 'Button 1',
action: 'Postback',
payload: 'button_clicked'
}
],
config: {
...defaultMessageConfig,
onSendData: async (data) => {
alert('onSendData called with: ' + JSON.stringify(data))
}
}
}
2 changes: 1 addition & 1 deletion packages/components/story/config/preview.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import '../../css/botpress-default.css'
import '../../src/css/botpress-default.css'
import './custom.css'

export const parameters = {
Expand Down
Loading

0 comments on commit 57d2b21

Please sign in to comment.