balloon
2 weeks ago
block-manager
2 months ago
block-style-manager
2 months ago
custom-block-style
2 months ago
custom-format
2 months ago
import-export
2 months ago
utils
2 months ago
block-category-position.js
2 months ago
breadcrumb.js
2 months ago
custom-css.js
2 months ago
index.js
2 months ago
license.js
2 months ago
load-separate.js
2 months ago
margin.js
2 months ago
new-faq.js
2 months ago
save-button.js
2 months ago
toc.js
2 months ago
breadcrumb.js
64 lines
| 1 | import { useState, useContext, useEffect } from '@wordpress/element'; |
| 2 | import { TextControl } from '@wordpress/components'; |
| 3 | import { __ } from '@wordpress/i18n'; |
| 4 | import { AdminContext } from '@vkblocks/admin/index'; |
| 5 | |
| 6 | export default function AdminBreadcrumb() { |
| 7 | const { vkBlocksOption, setVkBlocksOption } = useContext(AdminContext); |
| 8 | |
| 9 | const [separatorPrev, setSeparatorPrev] = useState( |
| 10 | vkBlocksOption.vk_blocks_pro_breadcrumb_separator || '/' |
| 11 | ); |
| 12 | |
| 13 | useEffect(() => { |
| 14 | // vkBlocksOption.vk_blocks_pro_breadcrumb_separator の値を監視して、変更があれば setSeparatorPrev にセット |
| 15 | setSeparatorPrev( |
| 16 | vkBlocksOption.vk_blocks_pro_breadcrumb_separator || '/' |
| 17 | ); |
| 18 | }, [vkBlocksOption.vk_blocks_pro_breadcrumb_separator]); |
| 19 | |
| 20 | return ( |
| 21 | <> |
| 22 | <section className="breadcrumb"> |
| 23 | <h3 id="breadcrumb-setting"> |
| 24 | {__('Breadcrumb Setting', 'vk-blocks')} |
| 25 | </h3> |
| 26 | <h4>{__('Separator Setting', 'vk-blocks')}</h4> |
| 27 | <p> |
| 28 | {__( |
| 29 | 'Please input the text you want to use as the separator.', |
| 30 | 'vk-blocks' |
| 31 | )} |
| 32 | <span style={{ marginLeft: '1em' }}> |
| 33 | {__('Ex: / , > , ≫', 'vk-blocks')} |
| 34 | </span> |
| 35 | </p> |
| 36 | <div className="flex-col"> |
| 37 | <TextControl |
| 38 | id="breadcrumb-selector" |
| 39 | className="separator_input" |
| 40 | name="vk_blocks_options[breadcrumb_separator_design]" |
| 41 | value={ |
| 42 | !vkBlocksOption.vk_blocks_pro_breadcrumb_separator |
| 43 | ? '' |
| 44 | : vkBlocksOption.vk_blocks_pro_breadcrumb_separator |
| 45 | } |
| 46 | onChange={(newValue) => { |
| 47 | newValue = newValue.trim(); |
| 48 | setVkBlocksOption({ |
| 49 | ...vkBlocksOption, |
| 50 | vk_blocks_pro_breadcrumb_separator: newValue, |
| 51 | }); |
| 52 | }} |
| 53 | /> |
| 54 | <div className="preview_area"> |
| 55 | {__('HOME', 'vk-blocks')} {separatorPrev}{' '} |
| 56 | {__('Parent page', 'vk-blocks')} {separatorPrev}{' '} |
| 57 | {__('Child page', 'vk-blocks')} |
| 58 | </div> |
| 59 | </div> |
| 60 | </section> |
| 61 | </> |
| 62 | ); |
| 63 | } |
| 64 |