Behavior.js
2 years ago
Controls.js
4 years ago
Edit.js
2 weeks ago
Edit.scss
2 weeks ago
Preset.js
4 years ago
Preview.js
3 years ago
Style.js
2 weeks ago
Style.scss
2 weeks ago
index.js
2 weeks ago
index.scss
2 weeks ago
Controls.js
108 lines
| 1 | /** |
| 2 | * WordPress dependencies |
| 3 | */ |
| 4 | const { __ } = wp.i18n; |
| 5 | const { ToggleControl, BaseControl } = wp.components; |
| 6 | |
| 7 | export default function ({ state, updateState, className }) { |
| 8 | return ( |
| 9 | <div className={className}> |
| 10 | <BaseControl> |
| 11 | <h3>{__("Controls", "presto-player")}</h3> |
| 12 | </BaseControl> |
| 13 | <BaseControl className="presto-player__control--large-play"> |
| 14 | <ToggleControl |
| 15 | label={__("Large Play Button", "presto-player")} |
| 16 | help={__( |
| 17 | "Adds a large play button over the top of the player.", |
| 18 | "presto-player" |
| 19 | )} |
| 20 | onChange={(play) => { |
| 21 | updateState({ "play-large": play }); |
| 22 | }} |
| 23 | checked={state["play-large"]} |
| 24 | /> |
| 25 | </BaseControl> |
| 26 | <BaseControl className="presto-player__control--rewind"> |
| 27 | <ToggleControl |
| 28 | label={__("Rewind", "presto-player")} |
| 29 | help={__( |
| 30 | "Adds a 10 second rewind button to the player.", |
| 31 | "presto-player" |
| 32 | )} |
| 33 | onChange={(rewind) => { |
| 34 | updateState({ rewind }); |
| 35 | }} |
| 36 | checked={state.rewind} |
| 37 | /> |
| 38 | </BaseControl> |
| 39 | <BaseControl className="presto-player__control--play"> |
| 40 | <ToggleControl |
| 41 | label={__("Small Play Button", "presto-player")} |
| 42 | help={__( |
| 43 | "Adds a small play button to the bottom of the player.", |
| 44 | "presto-player" |
| 45 | )} |
| 46 | onChange={(play) => { |
| 47 | updateState({ play }); |
| 48 | }} |
| 49 | checked={state.play} |
| 50 | /> |
| 51 | </BaseControl> |
| 52 | <BaseControl className="presto-player__control--fast-forward"> |
| 53 | <ToggleControl |
| 54 | label={__("Fast Forward", "presto-player")} |
| 55 | help={__( |
| 56 | "Adds a 10 second rewind button to the player.", |
| 57 | "presto-player" |
| 58 | )} |
| 59 | onChange={(value) => { |
| 60 | updateState({ "fast-forward": value }); |
| 61 | }} |
| 62 | checked={state["fast-forward"]} |
| 63 | /> |
| 64 | </BaseControl> |
| 65 | <BaseControl className="presto-player__control--progress"> |
| 66 | <ToggleControl |
| 67 | label={__("Progress Bar", "presto-player")} |
| 68 | help={__("Shows a seekable progress bar.", "presto-player")} |
| 69 | onChange={(progress) => { |
| 70 | updateState({ progress }); |
| 71 | }} |
| 72 | checked={state.progress} |
| 73 | /> |
| 74 | </BaseControl> |
| 75 | <BaseControl className="presto-player__control--current-time"> |
| 76 | <ToggleControl |
| 77 | label={__("Current Time", "presto-player")} |
| 78 | help={__("Shows the audio timestamp.", "presto-player")} |
| 79 | onChange={(value) => { |
| 80 | updateState({ "current-time": value }); |
| 81 | }} |
| 82 | checked={state["current-time"]} |
| 83 | /> |
| 84 | </BaseControl> |
| 85 | <BaseControl className="presto-player__control--volume"> |
| 86 | <ToggleControl |
| 87 | label={__("Volume", "presto-player")} |
| 88 | help={__("Shows a volume bar.", "presto-player")} |
| 89 | onChange={(value) => { |
| 90 | updateState({ volume: value, mute: value }); |
| 91 | }} |
| 92 | checked={state.volume} |
| 93 | /> |
| 94 | </BaseControl> |
| 95 | <BaseControl className="presto-player__control--speed"> |
| 96 | <ToggleControl |
| 97 | label={__("Speed", "presto-player")} |
| 98 | help={__("Shows playback speed controls.", "presto-player")} |
| 99 | onChange={(speed) => { |
| 100 | updateState({ speed }); |
| 101 | }} |
| 102 | checked={state.speed} |
| 103 | /> |
| 104 | </BaseControl> |
| 105 | </div> |
| 106 | ); |
| 107 | } |
| 108 |