parts
5 days ago
ActionBar.js
5 days ago
ActionBar.scss
5 days ago
Behavior.js
2 years ago
CTA.js
5 days ago
CTA.scss
5 days ago
Controls.js
5 years ago
Edit.js
5 days ago
Edit.scss
5 days ago
Email.js
5 days ago
Email.scss
5 days ago
Preset.js
4 years ago
Search.js
3 years ago
Style.js
5 days ago
Style.scss
5 days ago
Watermark.js
4 years ago
index.js
5 days ago
index.scss
5 days ago
Controls.js
144 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 video 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 | <BaseControl className="presto-player__control--pip"> |
| 106 | <ToggleControl |
| 107 | label={__("Picture In Picture (HTML5 only)", "presto-player")} |
| 108 | help={__( |
| 109 | "Allows users to dock the player on their screen and watch when using other app on their computer.", |
| 110 | "presto-player" |
| 111 | )} |
| 112 | onChange={(pip) => { |
| 113 | updateState({ pip }); |
| 114 | }} |
| 115 | checked={state.pip} |
| 116 | /> |
| 117 | </BaseControl> |
| 118 | <BaseControl className="presto-player__control--fullscreen"> |
| 119 | <ToggleControl |
| 120 | label={__("Fullscreen", "presto-player")} |
| 121 | help={__( |
| 122 | "Adds a button to allow the player to be fullscreen.", |
| 123 | "presto-player" |
| 124 | )} |
| 125 | onChange={(fullscreen) => { |
| 126 | updateState({ fullscreen }); |
| 127 | }} |
| 128 | checked={state.fullscreen} |
| 129 | /> |
| 130 | </BaseControl> |
| 131 | <BaseControl className="presto-player__control--captions"> |
| 132 | <ToggleControl |
| 133 | label={__("Captions", "presto-player")} |
| 134 | help={__("Shows a dedicated caption toggle button.", "presto-player")} |
| 135 | onChange={(value) => { |
| 136 | updateState({ captions: value }); |
| 137 | }} |
| 138 | checked={state["captions"]} |
| 139 | /> |
| 140 | </BaseControl> |
| 141 | </div> |
| 142 | ); |
| 143 | } |
| 144 |