|
1 |
| -import React from 'react'; |
2 |
| -import Blink from 'react-blink-text'; |
3 |
| -import SyntaxHighlighter from 'react-syntax-highlighter'; |
4 |
| -import { nord } from 'react-syntax-highlighter/dist/esm/styles/hljs'; |
| 1 | +import React, { useState } from "react"; |
| 2 | +import Blink from "react-blink-text"; |
| 3 | +// import Blink from "../../../lib/ReactBlinkText"; |
| 4 | +import SyntaxHighlighter from "react-syntax-highlighter"; |
| 5 | +import { nord } from "react-syntax-highlighter/dist/esm/styles/hljs"; |
5 | 6 |
|
6 | 7 | function BasicExample() {
|
| 8 | + const [state, setState] = useState({ |
| 9 | + blinkTime: 1, |
| 10 | + textAlign: "left", |
| 11 | + fontWeight: "bolder", |
| 12 | + textTransform: "none", |
| 13 | + textDecoration: "none", |
| 14 | + letterSpacing: "2px" |
| 15 | + }); |
| 16 | + const handler = event => { |
| 17 | + setState({ ...state, [event.target.name]: event.target.value }); |
| 18 | + }; |
7 | 19 | return (
|
8 | 20 | <div>
|
9 |
| - <h2>Basic Example</h2> |
| 21 | + <h2 className="App-link">Basic Example</h2> |
| 22 | + <label> |
| 23 | + Blink Time |
| 24 | + <input type="number" name="blinkTime" onChange={handler}></input> |
| 25 | + {" sec"} |
| 26 | + </label> |
| 27 | + <br></br> |
| 28 | + <label> |
| 29 | + Choose text Alignment |
| 30 | + <select name="textAlign" id="text-Align" onChange={handler}> |
| 31 | + <option value="">--Please choose an option--</option> |
| 32 | + <option value="left">left</option> |
| 33 | + <option value="right">right</option> |
| 34 | + <option value="center">center</option> |
| 35 | + </select> |
| 36 | + </label> |
| 37 | + <br></br> |
| 38 | + <label> |
| 39 | + Choose text fontWeight |
| 40 | + <select name="fontWeight" id="fontWeight" onChange={handler}> |
| 41 | + <option value="">--Please choose an option--</option> |
| 42 | + <option value="normal">normal</option> |
| 43 | + <option value="bold">bold</option> |
| 44 | + </select> |
| 45 | + </label> |
| 46 | + <br></br> |
| 47 | + <label> |
| 48 | + Choose text transform |
| 49 | + <select name="textTransform" id="textTransform" onChange={handler}> |
| 50 | + <option value="">--Please choose an option--</option> |
| 51 | + <option value="none">none</option> |
| 52 | + <option value="uppercase">uppercase</option> |
| 53 | + <option value="lowercase">lowercase</option> |
| 54 | + <option value="capitalize">capitalize</option> |
| 55 | + <option value="full-width">full-width</option> |
| 56 | + </select> |
| 57 | + </label> |
| 58 | + <br></br> |
| 59 | + <label> |
| 60 | + Choose text decoration |
| 61 | + <select name="textDecoration" id="textDecoration" onChange={handler}> |
| 62 | + <option value="">--Please choose an option--</option> |
| 63 | + <option value="none">none</option> |
| 64 | + <option value="underline">underline</option> |
| 65 | + <option value="overline">overline</option> |
| 66 | + <option value="cline-through">line-through</option> |
| 67 | + </select> |
| 68 | + </label> |
| 69 | + <br /> |
| 70 | + <label> |
| 71 | + letterSpacing |
| 72 | + <input type="number" name="letterSpacing" onChange={handler}></input> |
| 73 | + </label> |
10 | 74 | <SyntaxHighlighter language="javascript" style={nord}>
|
11 | 75 | <Blink text='Basic Blinking Text' />
|
12 | 76 | </SyntaxHighlighter>
|
13 |
| - Output:<br /> |
14 |
| - <Blink text='Basic Blinking Text' /> |
| 77 | + Output: |
| 78 | + |
| 79 | + <Blink |
| 80 | + text="Basic Blinking Text" |
| 81 | + textAlign={state.textAlign} |
| 82 | + blinkTime={state.blinkTime} |
| 83 | + fontWeight={state.fontWeight} |
| 84 | + textTransform={state.textTransform} |
| 85 | + textDecoration={state.textDecoration} |
| 86 | + letterSpacing={state.letterSpacing + "px"} |
| 87 | + /> |
15 | 88 | </div>
|
16 | 89 | );
|
17 | 90 | }
|
|
0 commit comments