KeyValueArray.tsx 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871
  1. import React, { useContext, useEffect, useState } from "react";
  2. import {
  3. GetFinalVariablesFunction,
  4. KeyValueArrayField,
  5. KeyValueArrayFieldState,
  6. PopulatedEnvGroup,
  7. } from "../types";
  8. import sliders from "../../../assets/sliders.svg";
  9. import upload from "../../../assets/upload.svg";
  10. import styled, { keyframes } from "styled-components";
  11. import useFormField from "../hooks/useFormField";
  12. import Modal from "../../../main/home/modals/Modal";
  13. import LoadEnvGroupModal from "../../../main/home/modals/LoadEnvGroupModal";
  14. import EnvEditorModal from "../../../main/home/modals/EnvEditorModal";
  15. import { hasSetValue } from "../utils";
  16. import _, { omit } from "lodash";
  17. import Helper from "components/form-components/Helper";
  18. import Heading from "components/form-components/Heading";
  19. import Loading from "components/Loading";
  20. import api from "shared/api";
  21. import { Context } from "shared/Context";
  22. interface Props extends KeyValueArrayField {
  23. id: string;
  24. }
  25. const KeyValueArray: React.FC<Props> = (props) => {
  26. const { state, setState, variables } = useFormField<KeyValueArrayFieldState>(
  27. props.id,
  28. {
  29. initState: () => {
  30. let values = props.value[0];
  31. const normalValues = Object.entries(values?.normal || {});
  32. values = omit(values, ["normal", "synced"]);
  33. return {
  34. values: hasSetValue(props)
  35. ? ([...Object.entries(values), ...normalValues]?.map(([k, v]) => {
  36. return { key: k, value: v };
  37. }) as any[])
  38. : [],
  39. showEnvModal: false,
  40. showEditorModal: false,
  41. synced_env_groups: props.settings?.options?.enable_synced_env_groups
  42. ? null
  43. : [],
  44. };
  45. },
  46. }
  47. );
  48. const { currentProject } = useContext(Context);
  49. // If the variable includes normal it means that the form corresponds to an old job template version
  50. // The "normal" keyword doesn't exist for applications as well as the enable_synced_env_groups setting.
  51. // This is why we have to check if the form corresponds to a job or not.
  52. const enableSyncedEnvGroups = props.variable.includes("normal")
  53. ? !!props.settings?.options?.enable_synced_env_groups
  54. : true;
  55. useEffect(() => {
  56. if (hasSetValue(props) && !Array.isArray(state?.synced_env_groups)) {
  57. const values = props.value[0];
  58. // console.log(values);
  59. const envGroups = values?.synced || [];
  60. const promises = Promise.all(
  61. envGroups.map(async (envGroup: any) => {
  62. const res = await api.getEnvGroup(
  63. "<token>",
  64. {},
  65. {
  66. id: currentProject.id,
  67. cluster_id: variables.clusterId,
  68. namespace: variables.namespace,
  69. name: envGroup?.name,
  70. version: envGroup.version,
  71. }
  72. );
  73. return res.data;
  74. })
  75. );
  76. promises.then((populatedEnvGroups) => {
  77. setState(() => ({
  78. synced_env_groups: Array.isArray(populatedEnvGroups)
  79. ? populatedEnvGroups
  80. : [],
  81. }));
  82. });
  83. }
  84. }, [
  85. props.value[0],
  86. variables?.clusterId,
  87. variables?.namespace,
  88. currentProject?.id,
  89. ]);
  90. if (state == undefined) return <></>;
  91. if (!Array.isArray(state.synced_env_groups) && enableSyncedEnvGroups) {
  92. return <Loading />;
  93. }
  94. const parseEnv = (src: any, options: any) => {
  95. const debug = Boolean(options && options.debug);
  96. const obj = {} as Record<string, string>;
  97. const NEWLINE = "\n";
  98. const RE_INI_KEY_VAL = /^\s*([\w.-]+)\s*=\s*(.*)?\s*$/;
  99. const RE_NEWLINES = /\\n/g;
  100. const NEWLINES_MATCH = /\n|\r|\r\n/;
  101. // convert Buffers before splitting into lines and processing
  102. src
  103. .toString()
  104. .split(NEWLINES_MATCH)
  105. .forEach(function (line: any, idx: any) {
  106. // matching "KEY' and 'VAL' in 'KEY=VAL'
  107. const keyValueArr = line.match(RE_INI_KEY_VAL);
  108. // matched?
  109. if (keyValueArr != null) {
  110. const key = keyValueArr[1];
  111. // default undefined or missing values to empty string
  112. let val = keyValueArr[2] || "";
  113. const end = val.length - 1;
  114. const isDoubleQuoted = val[0] === '"' && val[end] === '"';
  115. const isSingleQuoted = val[0] === "'" && val[end] === "'";
  116. // if single or double quoted, remove quotes
  117. if (isSingleQuoted || isDoubleQuoted) {
  118. val = val.substring(1, end);
  119. // if double quoted, expand newlines
  120. if (isDoubleQuoted) {
  121. val = val.replace(RE_NEWLINES, NEWLINE);
  122. }
  123. } else {
  124. // remove surrounding whitespace
  125. val = val.trim();
  126. }
  127. obj[key] = val;
  128. } else if (debug) {
  129. console.log(
  130. `did not match key and value when parsing line ${idx + 1}: ${line}`
  131. );
  132. }
  133. });
  134. return obj;
  135. };
  136. const readFile = (env: string) => {
  137. let envObj = parseEnv(env, null);
  138. let push = true;
  139. for (let key in envObj) {
  140. for (var i = 0; i < state.values.length; i++) {
  141. let existingKey = state.values[i]["key"];
  142. if (key === existingKey) {
  143. state.values[i]["value"] = envObj[key];
  144. push = false;
  145. }
  146. }
  147. if (push) {
  148. setState((prev) => {
  149. return {
  150. values: [...prev.values, { key, value: envObj[key] }],
  151. };
  152. });
  153. }
  154. }
  155. };
  156. const renderEditorModal = () => {
  157. if (state.showEditorModal) {
  158. return (
  159. <Modal
  160. onRequestClose={() =>
  161. setState(() => {
  162. return { showEditorModal: false };
  163. })
  164. }
  165. width="60%"
  166. height="80%"
  167. >
  168. <EnvEditorModal
  169. closeModal={() =>
  170. setState(() => {
  171. return { showEditorModal: false };
  172. })
  173. }
  174. setEnvVariables={(envFile: string) => readFile(envFile)}
  175. />
  176. </Modal>
  177. );
  178. }
  179. };
  180. const getProcessedValues = (
  181. objectArray: { key: string; value: string }[]
  182. ): any => {
  183. let obj = {} as any;
  184. objectArray?.forEach(({ key, value }) => {
  185. obj[key] = value;
  186. });
  187. return obj;
  188. };
  189. const renderEnvModal = () => {
  190. if (state.showEnvModal) {
  191. return (
  192. <Modal
  193. onRequestClose={() =>
  194. setState(() => {
  195. return { showEnvModal: false };
  196. })
  197. }
  198. width="800px"
  199. height="542px"
  200. >
  201. <LoadEnvGroupModal
  202. existingValues={getProcessedValues(state.values)}
  203. enableSyncedEnvGroups={enableSyncedEnvGroups}
  204. syncedEnvGroups={state.synced_env_groups}
  205. namespace={variables.namespace}
  206. clusterId={variables.clusterId}
  207. closeModal={() =>
  208. setState(() => {
  209. return {
  210. showEnvModal: false,
  211. };
  212. })
  213. }
  214. setSyncedEnvGroups={(value) => {
  215. setState((prev) => {
  216. return {
  217. synced_env_groups: [...(prev.synced_env_groups || []), value],
  218. };
  219. });
  220. }}
  221. setValues={(values) => {
  222. setState((prev) => {
  223. // Transform array to object similar on what we receive from setValues
  224. const prevValues = prev.values.reduce((acc, currentValue) => {
  225. acc[currentValue.key] = currentValue.value;
  226. return acc;
  227. }, {} as Record<string, string>);
  228. // Deconstruct the two records/objects inside one to merge their values (this will override the old duped vars too)
  229. // and convert the new object back to an array usable for the component
  230. const newValues = Object.entries({
  231. ...prevValues,
  232. ...values,
  233. })?.map(([k, v]) => {
  234. return {
  235. key: k,
  236. value: v,
  237. };
  238. });
  239. return {
  240. values: [...newValues],
  241. };
  242. });
  243. }}
  244. />
  245. </Modal>
  246. );
  247. }
  248. };
  249. const renderDeleteButton = (i: number) => {
  250. if (!props.isReadOnly) {
  251. return (
  252. <DeleteButton
  253. onClick={() => {
  254. state.values.splice(i, 1);
  255. setState((prev) => {
  256. return {
  257. values: prev.values
  258. .slice(0, i + 1)
  259. .concat(prev.values.slice(i + 1, prev.values.length)),
  260. };
  261. });
  262. }}
  263. >
  264. <i className="material-icons">cancel</i>
  265. </DeleteButton>
  266. );
  267. }
  268. };
  269. const renderHiddenOption = (hidden: boolean, i: number) => {
  270. if (props.secretOption && hidden) {
  271. return (
  272. <HideButton>
  273. <i className="material-icons">lock</i>
  274. </HideButton>
  275. );
  276. }
  277. };
  278. const checkOverridedKey = (key: string) => {
  279. const env_group = state.synced_env_groups.find(
  280. (env) => env?.variables && env?.variables[key]
  281. );
  282. if (env_group) {
  283. return (
  284. <Wrapper>
  285. <Helper color="#f5cb42" style={{ marginLeft: "10px" }}>
  286. Overridden by the env group "{env_group?.name}"
  287. </Helper>
  288. </Wrapper>
  289. );
  290. }
  291. return null;
  292. };
  293. const renderInputList = () => {
  294. return (
  295. <>
  296. {state.values?.map((entry: any, i: number) => {
  297. // Preprocess non-string env values set via raw Helm values
  298. let { value } = entry;
  299. if (typeof value === "object") {
  300. value = JSON.stringify(value);
  301. } else if (typeof value === "number" || typeof value === "boolean") {
  302. value = value.toString();
  303. }
  304. return (
  305. <InputWrapper key={i}>
  306. <Input
  307. placeholder="ex: key"
  308. width="270px"
  309. value={entry.key}
  310. onChange={(e: any) => {
  311. e.persist();
  312. setState((prev) => {
  313. return {
  314. values: prev.values?.map((t, j) => {
  315. if (j == i) {
  316. return {
  317. ...t,
  318. key: e.target.value,
  319. };
  320. }
  321. return t;
  322. }),
  323. };
  324. });
  325. }}
  326. disabled={props.isReadOnly || value.includes("PORTERSECRET")}
  327. spellCheck={false}
  328. borderColor={
  329. checkOverridedKey(entry.key) ? "#f5cb42" : undefined
  330. }
  331. />
  332. <Spacer />
  333. <Input
  334. placeholder="ex: value"
  335. width="270px"
  336. value={value}
  337. onChange={(e: any) => {
  338. e.persist();
  339. setState((prev) => {
  340. return {
  341. values: prev.values?.map((t, j) => {
  342. if (j == i) {
  343. return {
  344. ...t,
  345. value: e.target.value,
  346. };
  347. }
  348. return t;
  349. }),
  350. };
  351. });
  352. }}
  353. disabled={props.isReadOnly || value.includes("PORTERSECRET")}
  354. type={value.includes("PORTERSECRET") ? "password" : "text"}
  355. spellCheck={false}
  356. />
  357. {renderDeleteButton(i)}
  358. {renderHiddenOption(value.includes("PORTERSECRET"), i)}
  359. {checkOverridedKey(entry.key)}
  360. </InputWrapper>
  361. );
  362. })}
  363. </>
  364. );
  365. };
  366. return (
  367. <>
  368. <StyledInputArray>
  369. <Label>{props.label}</Label>
  370. {state.values.length === 0 ? <></> : renderInputList()}
  371. {props.isReadOnly ? (
  372. <></>
  373. ) : (
  374. <InputWrapper>
  375. <AddRowButton
  376. onClick={() => {
  377. setState((prev) => {
  378. return {
  379. values: [...prev.values, { key: "", value: "" }],
  380. };
  381. });
  382. }}
  383. >
  384. <i className="material-icons">add</i> Add Row
  385. </AddRowButton>
  386. <Spacer />
  387. {variables.namespace && props.envLoader && (
  388. <LoadButton
  389. onClick={() =>
  390. setState((prev) => {
  391. return {
  392. showEnvModal: !prev.showEnvModal,
  393. };
  394. })
  395. }
  396. >
  397. <img src={sliders} /> Load from Env Group
  398. </LoadButton>
  399. )}
  400. {props.fileUpload && (
  401. <UploadButton
  402. onClick={() => {
  403. setState((prev) => {
  404. return {
  405. showEditorModal: true,
  406. };
  407. });
  408. }}
  409. >
  410. <img src={upload} /> Copy from File
  411. </UploadButton>
  412. )}
  413. </InputWrapper>
  414. )}
  415. {enableSyncedEnvGroups && !!state.synced_env_groups?.length && (
  416. <>
  417. <Heading>Synced Environment Groups</Heading>
  418. <Br />
  419. {state.synced_env_groups?.map((envGroup: any) => {
  420. return (
  421. <ExpandableEnvGroup
  422. key={envGroup?.name}
  423. envGroup={envGroup}
  424. onDelete={() => {
  425. setState((prev) => {
  426. const synced = prev.synced_env_groups?.filter(
  427. (env) => env.name !== envGroup.name
  428. );
  429. return {
  430. ...prev,
  431. synced_env_groups: synced,
  432. };
  433. });
  434. }}
  435. />
  436. );
  437. })}
  438. </>
  439. )}
  440. </StyledInputArray>
  441. {renderEnvModal()}
  442. {renderEditorModal()}
  443. </>
  444. );
  445. };
  446. export const getFinalVariablesForKeyValueArray: GetFinalVariablesFunction = (
  447. vars,
  448. props: KeyValueArrayField,
  449. state: KeyValueArrayFieldState
  450. ) => {
  451. if (!state) {
  452. return {
  453. [props.variable]: hasSetValue(props) ? props.value[0] : [],
  454. };
  455. }
  456. if (props.variable.includes("env")) {
  457. let obj = {
  458. normal: {},
  459. } as any;
  460. const rg = /(?:^|[^\\])(\\n)/g;
  461. const fixNewlines = (s: string) => {
  462. while (rg.test(s)) {
  463. s = s.replace(rg, (str) => {
  464. if (str.length == 2) return "\n";
  465. if (str[0] != "\\") return str[0] + "\n";
  466. return "\\n";
  467. });
  468. }
  469. return s;
  470. };
  471. const isNumber = (s: string) => {
  472. return !isNaN(!s ? NaN : Number(String(s).trim()));
  473. };
  474. state.values.forEach((entry: any, i: number) => {
  475. if (isNumber(entry.value)) {
  476. obj.normal[entry.key] = entry.value;
  477. } else {
  478. obj.normal[entry.key] = fixNewlines(entry.value);
  479. }
  480. });
  481. if (state.synced_env_groups?.length) {
  482. obj.synced = state.synced_env_groups.map((envGroup) => ({
  483. name: envGroup?.name,
  484. version: envGroup?.version,
  485. keys: Object.entries(envGroup?.variables || {}).map(([key, val]) => ({
  486. name: key,
  487. secret: val.includes("PORTERSECRET"),
  488. })),
  489. }));
  490. }
  491. const variableContent = props.variable.split(".");
  492. let variable = props.variable;
  493. if (variable.includes("normal")) {
  494. variable = `${variableContent[0]}.${variableContent[1]}`;
  495. }
  496. return {
  497. [variable]: obj,
  498. };
  499. } else {
  500. let obj = {} as any;
  501. const rg = /(?:^|[^\\])(\\n)/g;
  502. const fixNewlines = (s: string) => {
  503. while (rg.test(s)) {
  504. s = s.replace(rg, (str) => {
  505. if (str.length == 2) return "\n";
  506. if (str[0] != "\\") return str[0] + "\n";
  507. return "\\n";
  508. });
  509. }
  510. return s;
  511. };
  512. const isNumber = (s: string) => {
  513. return !isNaN(!s ? NaN : Number(String(s).trim()));
  514. };
  515. state.values.forEach((entry: any, i: number) => {
  516. if (isNumber(entry.value)) {
  517. obj[entry.key] = entry.value;
  518. } else {
  519. obj[entry.key] = fixNewlines(entry.value);
  520. }
  521. });
  522. return {
  523. [props.variable]: obj,
  524. };
  525. }
  526. };
  527. export default KeyValueArray;
  528. const ExpandableEnvGroup: React.FC<{
  529. envGroup: PopulatedEnvGroup;
  530. onDelete: () => void;
  531. }> = ({ envGroup, onDelete }) => {
  532. const [isExpanded, setIsExpanded] = useState(false);
  533. return (
  534. <>
  535. <StyledCard>
  536. <Flex>
  537. <ContentContainer>
  538. <EventInformation>
  539. <EventName>{envGroup.name}</EventName>
  540. </EventInformation>
  541. </ContentContainer>
  542. <ActionContainer>
  543. <ActionButton onClick={() => onDelete()}>
  544. <span className="material-icons">delete</span>
  545. </ActionButton>
  546. <ActionButton onClick={() => setIsExpanded((prev) => !prev)}>
  547. <i className="material-icons">
  548. {isExpanded ? "arrow_drop_up" : "arrow_drop_down"}
  549. </i>
  550. </ActionButton>
  551. </ActionContainer>
  552. </Flex>
  553. {isExpanded && (
  554. <>
  555. <Buffer />
  556. {Object.entries(envGroup.variables || {})?.map(
  557. ([key, value], i: number) => {
  558. // Preprocess non-string env values set via raw Helm values
  559. if (typeof value === "object") {
  560. value = JSON.stringify(value);
  561. } else {
  562. value = String(value);
  563. }
  564. return (
  565. <InputWrapper key={i}>
  566. <Input
  567. placeholder="ex: key"
  568. width="270px"
  569. value={key}
  570. disabled
  571. />
  572. <Spacer />
  573. <Input
  574. placeholder="ex: value"
  575. width="270px"
  576. value={value}
  577. disabled
  578. type={
  579. value.includes("PORTERSECRET") ? "password" : "text"
  580. }
  581. />
  582. </InputWrapper>
  583. );
  584. }
  585. )}
  586. <Br />
  587. </>
  588. )}
  589. </StyledCard>
  590. </>
  591. );
  592. };
  593. const Br = styled.div`
  594. width: 100%;
  595. height: 1px;
  596. `;
  597. const Buffer = styled.div`
  598. width: 100%;
  599. height: 10px;
  600. `;
  601. const Spacer = styled.div`
  602. width: 10px;
  603. height: 20px;
  604. `;
  605. const AddRowButton = styled.div`
  606. display: flex;
  607. align-items: center;
  608. width: 270px;
  609. font-size: 13px;
  610. color: #aaaabb;
  611. height: 32px;
  612. border-radius: 3px;
  613. cursor: pointer;
  614. background: #ffffff11;
  615. :hover {
  616. background: #ffffff22;
  617. }
  618. > i {
  619. color: #ffffff44;
  620. font-size: 16px;
  621. margin-left: 8px;
  622. margin-right: 10px;
  623. display: flex;
  624. align-items: center;
  625. justify-content: center;
  626. }
  627. `;
  628. const LoadButton = styled(AddRowButton)`
  629. background: none;
  630. border: 1px solid #ffffff55;
  631. > i {
  632. color: #ffffff44;
  633. font-size: 16px;
  634. margin-left: 8px;
  635. margin-right: 10px;
  636. display: flex;
  637. align-items: center;
  638. justify-content: center;
  639. }
  640. > img {
  641. width: 14px;
  642. margin-left: 10px;
  643. margin-right: 12px;
  644. }
  645. `;
  646. const UploadButton = styled(AddRowButton)`
  647. background: none;
  648. position: relative;
  649. margin-left: 10px;
  650. border: 1px solid #ffffff55;
  651. > i {
  652. color: #ffffff44;
  653. font-size: 16px;
  654. margin-left: 8px;
  655. margin-right: 10px;
  656. display: flex;
  657. align-items: center;
  658. justify-content: center;
  659. }
  660. > img {
  661. width: 14px;
  662. margin-left: 10px;
  663. margin-right: 12px;
  664. }
  665. `;
  666. const DeleteButton = styled.div`
  667. width: 15px;
  668. height: 15px;
  669. display: flex;
  670. align-items: center;
  671. margin-left: 8px;
  672. margin-top: -3px;
  673. justify-content: center;
  674. > i {
  675. font-size: 17px;
  676. color: #ffffff44;
  677. display: flex;
  678. align-items: center;
  679. justify-content: center;
  680. cursor: pointer;
  681. :hover {
  682. color: #ffffff88;
  683. }
  684. }
  685. `;
  686. const HideButton = styled(DeleteButton)`
  687. margin-top: -5px;
  688. > i {
  689. font-size: 19px;
  690. cursor: default;
  691. :hover {
  692. color: #ffffff44;
  693. }
  694. }
  695. `;
  696. const Wrapper = styled.div`
  697. margin-left: 5px;
  698. height: 20px;
  699. display: flex;
  700. align-items: center;
  701. margin-top: -7px;
  702. `;
  703. const InputWrapper = styled.div`
  704. display: flex;
  705. align-items: center;
  706. margin-top: 5px;
  707. `;
  708. type InputProps = {
  709. disabled?: boolean;
  710. width: string;
  711. borderColor?: string;
  712. };
  713. const Input = styled.input<InputProps>`
  714. outline: none;
  715. border: none;
  716. margin-bottom: 5px;
  717. font-size: 13px;
  718. background: #ffffff11;
  719. border: 1px solid
  720. ${(props) => (props.borderColor ? props.borderColor : "#ffffff55")};
  721. border-radius: 3px;
  722. width: ${(props) => (props.width ? props.width : "270px")};
  723. color: ${(props) => (props.disabled ? "#ffffff44" : "white")};
  724. padding: 5px 10px;
  725. height: 35px;
  726. `;
  727. const Label = styled.div`
  728. color: #ffffff;
  729. margin-bottom: 10px;
  730. `;
  731. const StyledInputArray = styled.div`
  732. margin-bottom: 15px;
  733. margin-top: 22px;
  734. `;
  735. const fadeIn = keyframes`
  736. from {
  737. opacity: 0;
  738. }
  739. to {
  740. opacity: 1;
  741. }
  742. `;
  743. const StyledCard = styled.div`
  744. border: 1px solid #ffffff44;
  745. background: #ffffff11;
  746. margin-bottom: 5px;
  747. border-radius: 8px;
  748. margin-top: 15px;
  749. padding: 10px 14px;
  750. overflow: hidden;
  751. font-size: 13px;
  752. animation: ${fadeIn} 0.5s;
  753. `;
  754. const Flex = styled.div`
  755. display: flex;
  756. height: 25px;
  757. align-items: center;
  758. justify-content: space-between;
  759. `;
  760. const ContentContainer = styled.div`
  761. display: flex;
  762. height: 40px;
  763. width: 100%;
  764. align-items: center;
  765. `;
  766. const EventInformation = styled.div`
  767. display: flex;
  768. flex-direction: column;
  769. justify-content: space-around;
  770. height: 100%;
  771. `;
  772. const EventName = styled.div`
  773. font-family: "Work Sans", sans-serif;
  774. font-weight: 500;
  775. color: #ffffff;
  776. `;
  777. const ActionContainer = styled.div`
  778. display: flex;
  779. align-items: center;
  780. white-space: nowrap;
  781. height: 100%;
  782. `;
  783. const ActionButton = styled.button`
  784. position: relative;
  785. border: none;
  786. background: none;
  787. color: white;
  788. padding: 5px;
  789. width: 30px;
  790. height: 30px;
  791. margin-left: 5px;
  792. display: flex;
  793. justify-content: center;
  794. align-items: center;
  795. border-radius: 50%;
  796. cursor: pointer;
  797. color: #aaaabb;
  798. border: 1px solid #ffffff00;
  799. :hover {
  800. background: #ffffff11;
  801. border: 1px solid #ffffff44;
  802. }
  803. > span {
  804. font-size: 20px;
  805. }
  806. `;