This repository has been archived by the owner on Aug 6, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #665 from appsmithorg/editable-text
feat: Added editable text
- Loading branch information
Showing
4 changed files
with
137 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,42 @@ | ||
import React from "react"; | ||
import { ComponentMeta, ComponentStory } from "@storybook/react"; | ||
import { Meta, StoryObj } from "@storybook/react"; | ||
import { useArgs } from "@storybook/preview-api"; | ||
|
||
import { Text } from "./index"; | ||
|
||
export default { | ||
title: "Design System/Text", | ||
component: Text, | ||
} as ComponentMeta<typeof Text>; | ||
} as Meta<typeof Text>; | ||
|
||
// eslint-disable-next-line react/function-component-definition | ||
const Template: ComponentStory<typeof Text> = (args) => { | ||
return <Text {...args} />; | ||
type Story = StoryObj<typeof Text>; | ||
|
||
export const TextStory: Story = { | ||
name: "Text", | ||
args: { | ||
children: "How vexingly quick daft zebras jump!", | ||
}, | ||
}; | ||
|
||
export const TextStory = Template.bind({}); | ||
TextStory.storyName = "Text"; | ||
TextStory.args = { | ||
children: "How vexingly quick daft zebras jump!", | ||
export const EditableTextStory: Story = { | ||
name: "Editable Text", | ||
args: { | ||
children: "How vexingly quick daft zebras jump!", | ||
isEditable: true, | ||
kind: "body-m", | ||
}, | ||
render: function Render(args) { | ||
const [text, setText] = React.useState(args.children); | ||
|
||
return ( | ||
<Text | ||
{...args} | ||
onChange={(e) => { | ||
setText(e.target.value); | ||
}} | ||
> | ||
{text} | ||
</Text> | ||
); | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters