@@ -44,11 +44,21 @@ export default {
44
44
const style = { width : "600px" , height : "400px" } ;
45
45
46
46
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
+ [ / ( b u t | a n d | s o | a l s o ) + / g, { textDecoration : "line-through" , color : "green" } ] ,
54
+ [ / [ 0 1 2 3 4 5 6 7 8 9 ] + / g, { color : "violet" , fontWeight : "bold" } ] ,
48
55
] ;
49
56
50
57
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
+ ) ;
52
62
return (
53
63
< Textarea
54
64
matchers = { basicMatcher }
@@ -59,6 +69,21 @@ export const Basic = () => {
59
69
) ;
60
70
} ;
61
71
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
+ } ;
62
87
const manyMatcher : Matcher [ ] = [
63
88
[ / [ A - Z ] [ a - z ] + / g, { borderRadius : "3px" , backgroundColor : "#d0bfff" } ] ,
64
89
[ / i p s u m / g, { color : "blue" , textDecoration : "underline wavy" } ] ,
0 commit comments