_rule-app.scss 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501
  1. $color-primary: #FFC907;
  2. $color-secondary: #29335C;
  3. $color-warning: #ff8f07;
  4. $color-danger: #ff073d;
  5. $color-success: #C2F9BB;
  6. $tablet: 768px;
  7. $mobile: 420px;
  8. .rule-app {
  9. padding: 2rem;
  10. position: relative;
  11. * {
  12. box-sizing: border-box;
  13. }
  14. @media screen and (max-width: $tablet) {
  15. padding: 2rem .5rem;
  16. }
  17. }
  18. .btn {
  19. border-radius: 4px;
  20. padding: .2em 1em;
  21. background-color: transparent;
  22. border: 1px solid $color-secondary;
  23. &.has-icon {
  24. padding-left: .25em;
  25. }
  26. &.is-large {
  27. font-size: 1.2em;
  28. }
  29. &.is-loading img {
  30. animation: rotation 2s infinite linear;
  31. }
  32. @keyframes rotation {
  33. from {
  34. transform: rotate(0deg);
  35. }
  36. to {
  37. transform: rotate(-359deg);
  38. }
  39. }
  40. &:hover {
  41. cursor: pointer;
  42. color: $color-secondary;
  43. border-color: black;
  44. }
  45. &.primary {
  46. background-color: $color-primary;
  47. color:darken($color-primary, 80%);
  48. border: 1px solid darken($color-primary, 10%);
  49. &:hover {
  50. cursor: pointer;
  51. background-color: darken($color-primary, 10%);
  52. }
  53. }
  54. &.warn {
  55. background-color: $color-warning;
  56. color:darken($color-warning, 80%);
  57. border: 1px solid darken($color-warning, 10%);
  58. &:hover {
  59. cursor: pointer;
  60. background-color: darken($color-warning, 10%);
  61. }
  62. }
  63. &.danger {
  64. background-color: $color-danger;
  65. color:darken($color-danger, 80%);
  66. border: 1px solid darken($color-danger, 10%);
  67. &:hover {
  68. cursor: pointer;
  69. background-color: darken($color-danger, 10%);
  70. }
  71. }
  72. &.success {
  73. background-color: $color-success;
  74. color:darken($color-success, 80%);
  75. border: 1px solid darken($color-success, 10%);
  76. &:hover {
  77. cursor: pointer;
  78. background-color: darken($color-success, 10%);
  79. }
  80. }
  81. }
  82. .btn-group {
  83. display: flex;
  84. flex-wrap: wrap;
  85. gap: 1rem;
  86. margin: 1rem 0;
  87. }
  88. .btn {
  89. position: relative;
  90. .btn-cover {
  91. position: absolute;
  92. font-size: 0.6em;
  93. background-color: $color-warning;
  94. width: 110%;
  95. top: 30%;
  96. left: -10px;
  97. box-shadow: 1px 1px 3px #0003;
  98. transform: rotate(0deg) scale(.01);
  99. transition: all 0.3s ease;
  100. }
  101. &:hover .btn-cover {
  102. transform: rotate(5deg) scale(1);
  103. }
  104. }
  105. h1 .icon img {
  106. width: 50px;
  107. }
  108. h2 .icon img {
  109. width: 40px;
  110. }
  111. .label {
  112. display: block;
  113. flex: 1 1 auto;
  114. &>span {
  115. display: block;
  116. }
  117. input[type='text'],
  118. textarea {
  119. font-size: 1.2rem;
  120. font-family: monospace;
  121. margin: .5rem 0 1rem;
  122. padding: .25rem;
  123. width: 100%;
  124. }
  125. textarea {
  126. max-width: 65ch;
  127. }
  128. input.input-stack {
  129. margin-bottom: 0;
  130. }
  131. small {
  132. color: #aaa;
  133. }
  134. }
  135. .label-group {
  136. display: flex;
  137. gap: 1rem;
  138. @media screen and (max-width: $tablet) {
  139. &:not(.is-mobile){
  140. gap: 0;
  141. flex-direction: column;
  142. }
  143. }
  144. @media screen and (max-width: $mobile) {
  145. gap: 0;
  146. flex-direction: column;
  147. }
  148. }
  149. .dropdown {
  150. $dropdown-border-radius: 4px;
  151. cursor: pointer;
  152. flex-direction: column;
  153. background-color: #fff;
  154. padding: 2px;
  155. border-radius: $dropdown-border-radius;
  156. input[type='radio'] {
  157. display: none;
  158. }
  159. label {
  160. cursor: pointer;
  161. }
  162. label div {
  163. display: inline-flex;
  164. padding: 2px;
  165. }
  166. input[type='radio']:checked ~ div {
  167. background-color: $color-primary;
  168. border-radius: $dropdown-border-radius;
  169. }
  170. @media screen and (max-width: $tablet) {
  171. display: grid;
  172. grid-template-columns: repeat( auto-fit, minmax(50px, 1fr) );
  173. label.default {
  174. display: none;
  175. }
  176. }
  177. @media screen and (min-width: $tablet) {
  178. position: absolute;
  179. label:not(.selected) {
  180. display: none;
  181. }
  182. &:hover {
  183. border: 1px solid #ddd;
  184. box-shadow: 1px 1px 5px #0003;
  185. display: grid;
  186. grid-template-columns: 1fr 1fr 1fr;
  187. label {
  188. display: block;
  189. &:hover:not(.selected) div {
  190. background-color: #ddd;
  191. border-radius: $dropdown-border-radius;
  192. }
  193. }
  194. }
  195. &:hover label.default,
  196. label.selected ~ label.default {
  197. display: none;
  198. }
  199. label.default {
  200. display: block;
  201. }
  202. }
  203. }
  204. .editor .details {
  205. .label .dropdown {
  206. margin-top: calc(.5rem - 2px);
  207. img {
  208. width: 30px;
  209. }
  210. @media screen and (min-width: $tablet) {
  211. &:hover {
  212. grid-template-columns: repeat(4, 1fr);
  213. z-index: 100;
  214. }
  215. }
  216. }
  217. }
  218. .rule__modules {
  219. border: 4px dashed $color-primary;
  220. margin: 1rem 0;
  221. position: relative;
  222. @media screen and (max-width: $tablet) {
  223. margin: 1rem -0.75rem;
  224. }
  225. &.target {
  226. background-color: $color-primary;
  227. }
  228. .modules__dropzone {
  229. padding: 1.25rem 1rem 1rem;
  230. .module.drag-over {
  231. background-color: $color-primary;
  232. border-style: dashed;
  233. }
  234. }
  235. label {
  236. position: absolute;
  237. top: -1rem;
  238. left: 1rem;
  239. background: $color-primary;
  240. padding: 0.25rem .5rem;
  241. border-radius: 3px;
  242. font-size: 0.8rem;
  243. font-weight: bold;
  244. display: flex;
  245. align-items: center;
  246. gap: 0.5rem;
  247. }
  248. }
  249. .module-editor__wrapper {
  250. background-color: #fff;
  251. border: 1px solid #ccc;
  252. border-radius: 3px;
  253. box-shadow: 0 0 5px #0002;
  254. margin: 2rem 0 1rem;
  255. padding: 1rem;
  256. position: relative;
  257. .module-editor {
  258. display: flex;
  259. flex-direction: row-reverse;
  260. justify-content: space-between;
  261. padding-top: .5rem;
  262. .module-editor__right {
  263. position: absolute;
  264. top: -1.2rem;
  265. right: 1rem;
  266. }
  267. .module-editor__fields {
  268. flex: 1 1 auto;
  269. }
  270. .label {
  271. font-size: 0.8em;
  272. input,
  273. textarea {
  274. font-size: 1rem;
  275. margin-top: 0;
  276. }
  277. }
  278. }
  279. .module-editor__label {
  280. position: absolute;
  281. top: -1rem;
  282. left: 1rem;
  283. background: #fff;
  284. }
  285. }
  286. .module {
  287. align-items: center;
  288. display: inline-flex;
  289. gap: 0.5rem;
  290. margin: 0;
  291. padding: .25rem;
  292. flex-wrap: wrap;
  293. &.in-editor {
  294. background-color: $color-primary;
  295. }
  296. .submodules {
  297. display: flex;
  298. gap: 0.5rem;
  299. flex-wrap: wrap;
  300. }
  301. .module__grain {
  302. display: none;
  303. opacity: .3;
  304. cursor: grab;
  305. }
  306. &.mouse-over > .module__icon-wrapper {
  307. & > .module__grain {
  308. display: block;
  309. opacity: 1;
  310. }
  311. & > .module__icon {
  312. display: none;
  313. }
  314. }
  315. &.module--edit {
  316. font-family: monospace;
  317. padding: 0;
  318. input {
  319. width: fit-content;
  320. margin: 0;
  321. padding: 0.25rem
  322. }
  323. }
  324. }
  325. .modules__grid {
  326. display: flex;
  327. flex-wrap: wrap;
  328. gap: 0.5rem;
  329. }
  330. .modules {
  331. .modules__type {
  332. margin-bottom: 1rem;
  333. }
  334. h2 {
  335. margin-bottom: 0;
  336. &::first-letter {
  337. text-transform: capitalize;
  338. }
  339. }
  340. .modules__header {
  341. display: flex;
  342. justify-content: space-between;
  343. align-items: center;
  344. a {
  345. cursor: pointer;
  346. }
  347. }
  348. }
  349. .rule {
  350. .rule__creator {
  351. display: flex;
  352. align-items: center;
  353. justify-content: center;
  354. gap: 1rem;
  355. border-top: 1px solid #ccc;
  356. margin-top: 2rem;
  357. padding-top: 2rem;
  358. }
  359. }
  360. .tabs {
  361. display: flex;
  362. flex-wrap: wrap;
  363. gap: 1rem;
  364. .tab__control {
  365. cursor: pointer;
  366. border: 1px solid #ccc;
  367. border-bottom: none;
  368. background-color: #ccc;
  369. padding: .5rem 1rem;
  370. text-align: center;
  371. flex: 1 1 auto;
  372. &.active {
  373. background-color: #fff;
  374. margin-bottom: -1px;
  375. }
  376. }
  377. @media screen and (max-width: $tablet) {
  378. gap:.5rem;
  379. font-size: 0.8rem;
  380. .tab__control img {
  381. display: block;
  382. margin: 0 auto;
  383. }
  384. }
  385. @media screen and (max-width: 550px) {
  386. gap: 0;
  387. }
  388. }
  389. .tab__pane {
  390. border: 1px solid #ccc;
  391. padding: 1rem;
  392. margin-bottom: 2rem;
  393. }
  394. .app-wrapper.is-preview {
  395. max-width: 65ch;
  396. margin: 0 auto;
  397. }
  398. .editor,
  399. .rule {
  400. border: 1px solid #ccc;
  401. border-radius: 3px;
  402. background-color: #fff;
  403. margin: 0 auto;
  404. padding: 2rem;
  405. position: relative;
  406. .controls {
  407. position: absolute;
  408. top: -1rem;
  409. right: 2rem;
  410. }
  411. @media screen and (max-width: $tablet) {
  412. padding: 1.5rem 1rem 1rem;
  413. }
  414. @media screen and (max-width: $mobile) {
  415. font-size: 90%;
  416. }
  417. }
  418. .editor {
  419. }
  420. .rule {
  421. .modules__grid {
  422. padding: 1rem 0;
  423. }
  424. .module-list {
  425. margin-bottom: 1rem;
  426. &, & ul { margin-left: 30px; }
  427. .submodules { margin-bottom: 1rem;}
  428. .module-list-item {
  429. list-style: none;
  430. position: relative;
  431. .module__icon {
  432. position: absolute;
  433. left:-30px;
  434. top:-3px;
  435. }
  436. }
  437. }
  438. }
  439. .json {
  440. white-space: pre-wrap;
  441. }
  442. .legacy {
  443. .module {
  444. img,
  445. a {
  446. display: none;
  447. }
  448. }
  449. }