logo

pleroma-fe

My custom branche(s) on git.pleroma.social/pleroma/pleroma-fe git clone https://hacktivis.me/git/pleroma-fe.git

shadow_control.vue (7082B)


  1. <template>
  2. <div
  3. class="shadow-control"
  4. :class="{ disabled: !present }"
  5. >
  6. <div class="shadow-preview-container">
  7. <div
  8. :disabled="!present"
  9. class="y-shift-control"
  10. >
  11. <input
  12. v-model="selected.y"
  13. :disabled="!present"
  14. class="input input-number"
  15. type="number"
  16. >
  17. <div class="wrap">
  18. <input
  19. v-model="selected.y"
  20. :disabled="!present"
  21. class="input input-range"
  22. type="range"
  23. max="20"
  24. min="-20"
  25. >
  26. </div>
  27. </div>
  28. <div class="preview-window">
  29. <div
  30. class="preview-block"
  31. :style="style"
  32. />
  33. </div>
  34. <div
  35. :disabled="!present"
  36. class="x-shift-control"
  37. >
  38. <input
  39. v-model="selected.x"
  40. :disabled="!present"
  41. class="input input-number"
  42. type="number"
  43. >
  44. <div class="wrap">
  45. <input
  46. v-model="selected.x"
  47. :disabled="!present"
  48. class="input input-range"
  49. type="range"
  50. max="20"
  51. min="-20"
  52. >
  53. </div>
  54. </div>
  55. </div>
  56. <div class="shadow-tweak">
  57. <div
  58. :disabled="usingFallback"
  59. class="id-control style-control"
  60. >
  61. <Select
  62. id="shadow-switcher"
  63. v-model="selectedId"
  64. class="shadow-switcher"
  65. :disabled="!ready || usingFallback"
  66. >
  67. <option
  68. v-for="(shadow, index) in cValue"
  69. :key="index"
  70. :value="index"
  71. >
  72. {{ $t('settings.style.shadows.shadow_id', { value: index }) }}
  73. </option>
  74. </Select>
  75. <button
  76. class="btn button-default"
  77. :disabled="!ready || !present"
  78. @click="del"
  79. >
  80. <FAIcon
  81. fixed-width
  82. icon="times"
  83. />
  84. </button>
  85. <button
  86. class="btn button-default"
  87. :disabled="!moveUpValid"
  88. @click="moveUp"
  89. >
  90. <FAIcon
  91. fixed-width
  92. icon="chevron-up"
  93. />
  94. </button>
  95. <button
  96. class="btn button-default"
  97. :disabled="!moveDnValid"
  98. @click="moveDn"
  99. >
  100. <FAIcon
  101. fixed-width
  102. icon="chevron-down"
  103. />
  104. </button>
  105. <button
  106. class="btn button-default"
  107. :disabled="usingFallback"
  108. @click="add"
  109. >
  110. <FAIcon
  111. fixed-width
  112. icon="plus"
  113. />
  114. </button>
  115. </div>
  116. <div
  117. :disabled="!present"
  118. class="inset-control style-control"
  119. >
  120. <label
  121. for="inset"
  122. class="label"
  123. >
  124. {{ $t('settings.style.shadows.inset') }}
  125. </label>
  126. <input
  127. id="inset"
  128. v-model="selected.inset"
  129. :disabled="!present"
  130. name="inset"
  131. class="input -checkbox input-inset visible-for-screenreader-only"
  132. type="checkbox"
  133. >
  134. <label
  135. class="checkbox-label"
  136. for="inset"
  137. :aria-hidden="true"
  138. />
  139. </div>
  140. <div
  141. :disabled="!present"
  142. class="blur-control style-control"
  143. >
  144. <label
  145. for="spread"
  146. class="label"
  147. >
  148. {{ $t('settings.style.shadows.blur') }}
  149. </label>
  150. <input
  151. id="blur"
  152. v-model="selected.blur"
  153. :disabled="!present"
  154. name="blur"
  155. class="input input-range"
  156. type="range"
  157. max="20"
  158. min="0"
  159. >
  160. <input
  161. v-model="selected.blur"
  162. :disabled="!present"
  163. class="input input-number"
  164. type="number"
  165. min="0"
  166. >
  167. </div>
  168. <div
  169. :disabled="!present"
  170. class="spread-control style-control"
  171. >
  172. <label
  173. for="spread"
  174. class="label"
  175. >
  176. {{ $t('settings.style.shadows.spread') }}
  177. </label>
  178. <input
  179. id="spread"
  180. v-model="selected.spread"
  181. :disabled="!present"
  182. name="spread"
  183. class="input input-range"
  184. type="range"
  185. max="20"
  186. min="-20"
  187. >
  188. <input
  189. v-model="selected.spread"
  190. :disabled="!present"
  191. class="input input-number"
  192. type="number"
  193. >
  194. </div>
  195. <ColorInput
  196. v-model="selected.color"
  197. :disabled="!present"
  198. :label="$t('settings.style.common.color')"
  199. :fallback="currentFallback.color"
  200. :show-optional-tickbox="false"
  201. name="shadow"
  202. />
  203. <OpacityInput
  204. v-model="selected.alpha"
  205. :disabled="!present"
  206. />
  207. <i18n-t
  208. scope="global"
  209. keypath="settings.style.shadows.hintV3"
  210. tag="p"
  211. >
  212. <code>--variable,mod</code>
  213. </i18n-t>
  214. </div>
  215. </div>
  216. </template>
  217. <script src="./shadow_control.js"></script>
  218. <style lang="scss">
  219. .shadow-control {
  220. display: flex;
  221. flex-wrap: wrap;
  222. justify-content: center;
  223. margin-bottom: 1em;
  224. .shadow-preview-container,
  225. .shadow-tweak {
  226. margin: 5px 6px 0 0;
  227. }
  228. .shadow-preview-container {
  229. flex: 0;
  230. display: flex;
  231. flex-wrap: wrap;
  232. input[type="number"] {
  233. width: 5em;
  234. min-width: 2em;
  235. }
  236. .x-shift-control,
  237. .y-shift-control {
  238. display: flex;
  239. flex: 0;
  240. &[disabled="disabled"] * {
  241. opacity: 0.5;
  242. }
  243. }
  244. .x-shift-control {
  245. align-items: flex-start;
  246. }
  247. .x-shift-control .wrap,
  248. input[type="range"] {
  249. margin: 0;
  250. width: 15em;
  251. height: 2em;
  252. }
  253. .y-shift-control {
  254. flex-direction: column;
  255. align-items: flex-end;
  256. .wrap {
  257. width: 2em;
  258. height: 15em;
  259. }
  260. input[type="range"] {
  261. transform-origin: 1em 1em;
  262. transform: rotate(90deg);
  263. }
  264. }
  265. .preview-window {
  266. flex: 1;
  267. background-color: #999;
  268. display: flex;
  269. align-items: center;
  270. justify-content: center;
  271. background-image:
  272. linear-gradient(45deg, #666 25%, transparent 25%),
  273. linear-gradient(-45deg, #666 25%, transparent 25%),
  274. linear-gradient(45deg, transparent 75%, #666 75%),
  275. linear-gradient(-45deg, transparent 75%, #666 75%);
  276. background-size: 20px 20px;
  277. background-position: 0 0, 0 10px, 10px -10px, -10px 0;
  278. border-radius: var(--roundness);
  279. .preview-block {
  280. width: 33%;
  281. height: 33%;
  282. border-radius: var(--roundness);
  283. }
  284. }
  285. }
  286. .shadow-tweak {
  287. flex: 1;
  288. min-width: 280px;
  289. .id-control {
  290. align-items: stretch;
  291. .shadow-switcher {
  292. flex: 1;
  293. }
  294. .shadow-switcher,
  295. .btn {
  296. min-width: 1px;
  297. margin-right: 5px;
  298. }
  299. .btn {
  300. padding: 0 0.4em;
  301. margin: 0 0.1em;
  302. }
  303. }
  304. }
  305. }
  306. </style>