_rule-app.scss 8.5 KB

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