Skip to content

Commit 53fa7c2

Browse files
committed
Update basics.stories.tsx
1 parent 0e1f5e3 commit 53fa7c2

File tree

1 file changed

+27
-2
lines changed

1 file changed

+27
-2
lines changed

stories/basics.stories.tsx

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,21 @@ export default {
4444
const style = { width: "600px", height: "400px" };
4545

4646
const basicMatcher: Matcher[] = [
47-
[/[A-Z][a-z]+/g, { borderRadius: "3px", backgroundColor: "#d0bfff" }],
47+
[/[A-Z][A-x]+/g, { color: "blue" }],
48+
[
49+
/[A-Z][A-Z]+/g,
50+
{ borderRadius: "3px", backgroundColor: "blue", color: "white" },
51+
],
52+
[/[!?]+/g, { textDecoration: "underline wavy", color: "red" }],
53+
[/(but|and|so|also)+/g, { textDecoration: "line-through", color: "green" }],
54+
[/[0123456789]+/g, { color: "violet", fontWeight: "bold" }],
4855
];
4956

5057
export const Basic = () => {
51-
const [text, setText] = useState(lorem);
58+
const [text, setText] = useState(
59+
`This is just a TEXTAREA but bit rich!!!
60+
12345`
61+
);
5262
return (
5363
<Textarea
5464
matchers={basicMatcher}
@@ -59,6 +69,21 @@ export const Basic = () => {
5969
);
6070
};
6171

72+
const simpleMatcher: Matcher[] = [
73+
[/[A-Z][a-z]+/g, { borderRadius: "3px", backgroundColor: "#d0bfff" }],
74+
];
75+
76+
export const Simple = () => {
77+
const [text, setText] = useState(lorem);
78+
return (
79+
<Textarea
80+
matchers={simpleMatcher}
81+
style={style}
82+
onChange={useCallback((e) => setText(e.target.value), [])}
83+
value={text}
84+
/>
85+
);
86+
};
6287
const manyMatcher: Matcher[] = [
6388
[/[A-Z][a-z]+/g, { borderRadius: "3px", backgroundColor: "#d0bfff" }],
6489
[/ipsum/g, { color: "blue", textDecoration: "underline wavy" }],

0 commit comments

Comments
 (0)