KeyValueArray.tsx 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875
  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", "build"]);
  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 (Array.isArray(props.value) && props.value[0]?.build) {
  482. obj.build = props.value[0].build;
  483. }
  484. if (state.synced_env_groups?.length) {
  485. obj.synced = state.synced_env_groups.map((envGroup) => ({
  486. name: envGroup?.name,
  487. version: envGroup?.version,
  488. keys: Object.entries(envGroup?.variables || {}).map(([key, val]) => ({
  489. name: key,
  490. secret: val.includes("PORTERSECRET"),
  491. })),
  492. }));
  493. }
  494. const variableContent = props.variable.split(".");
  495. let variable = props.variable;
  496. if (variable.includes("normal")) {
  497. variable = `${variableContent[0]}.${variableContent[1]}`;
  498. }
  499. return {
  500. [variable]: obj,
  501. };
  502. } else {
  503. let obj = {} as any;
  504. const rg = /(?:^|[^\\])(\\n)/g;
  505. const fixNewlines = (s: string) => {
  506. while (rg.test(s)) {
  507. s = s.replace(rg, (str) => {
  508. if (str.length == 2) return "\n";
  509. if (str[0] != "\\") return str[0] + "\n";
  510. return "\\n";
  511. });
  512. }
  513. return s;
  514. };
  515. const isNumber = (s: string) => {
  516. return !isNaN(!s ? NaN : Number(String(s).trim()));
  517. };
  518. state.values.forEach((entry: any, i: number) => {
  519. if (isNumber(entry.value)) {
  520. obj[entry.key] = entry.value;
  521. } else {
  522. obj[entry.key] = fixNewlines(entry.value);
  523. }
  524. });
  525. return {
  526. [props.variable]: obj,
  527. };
  528. }
  529. };
  530. export default KeyValueArray;
  531. const ExpandableEnvGroup: React.FC<{
  532. envGroup: PopulatedEnvGroup;
  533. onDelete: () => void;
  534. }> = ({ envGroup, onDelete }) => {
  535. const [isExpanded, setIsExpanded] = useState(false);
  536. return (
  537. <>
  538. <StyledCard>
  539. <Flex>
  540. <ContentContainer>
  541. <EventInformation>
  542. <EventName>{envGroup.name}</EventName>
  543. </EventInformation>
  544. </ContentContainer>
  545. <ActionContainer>
  546. <ActionButton onClick={() => onDelete()}>
  547. <span className="material-icons">delete</span>
  548. </ActionButton>
  549. <ActionButton onClick={() => setIsExpanded((prev) => !prev)}>
  550. <i className="material-icons">
  551. {isExpanded ? "arrow_drop_up" : "arrow_drop_down"}
  552. </i>
  553. </ActionButton>
  554. </ActionContainer>
  555. </Flex>
  556. {isExpanded && (
  557. <>
  558. <Buffer />
  559. {Object.entries(envGroup.variables || {})?.map(
  560. ([key, value], i: number) => {
  561. // Preprocess non-string env values set via raw Helm values
  562. if (typeof value === "object") {
  563. value = JSON.stringify(value);
  564. } else {
  565. value = String(value);
  566. }
  567. return (
  568. <InputWrapper key={i}>
  569. <Input
  570. placeholder="ex: key"
  571. width="270px"
  572. value={key}
  573. disabled
  574. />
  575. <Spacer />
  576. <Input
  577. placeholder="ex: value"
  578. width="270px"
  579. value={value}
  580. disabled
  581. type={
  582. value.includes("PORTERSECRET") ? "password" : "text"
  583. }
  584. />
  585. </InputWrapper>
  586. );
  587. }
  588. )}
  589. <Br />
  590. </>
  591. )}
  592. </StyledCard>
  593. </>
  594. );
  595. };
  596. const Br = styled.div`
  597. width: 100%;
  598. height: 1px;
  599. `;
  600. const Buffer = styled.div`
  601. width: 100%;
  602. height: 10px;
  603. `;
  604. const Spacer = styled.div`
  605. width: 10px;
  606. height: 20px;
  607. `;
  608. const AddRowButton = styled.div`
  609. display: flex;
  610. align-items: center;
  611. width: 270px;
  612. font-size: 13px;
  613. color: #aaaabb;
  614. height: 32px;
  615. border-radius: 3px;
  616. cursor: pointer;
  617. background: #ffffff11;
  618. :hover {
  619. background: #ffffff22;
  620. }
  621. > i {
  622. color: #ffffff44;
  623. font-size: 16px;
  624. margin-left: 8px;
  625. margin-right: 10px;
  626. display: flex;
  627. align-items: center;
  628. justify-content: center;
  629. }
  630. `;
  631. const LoadButton = styled(AddRowButton)`
  632. background: none;
  633. border: 1px solid #ffffff55;
  634. > i {
  635. color: #ffffff44;
  636. font-size: 16px;
  637. margin-left: 8px;
  638. margin-right: 10px;
  639. display: flex;
  640. align-items: center;
  641. justify-content: center;
  642. }
  643. > img {
  644. width: 14px;
  645. margin-left: 10px;
  646. margin-right: 12px;
  647. }
  648. `;
  649. const UploadButton = styled(AddRowButton)`
  650. background: none;
  651. position: relative;
  652. margin-left: 10px;
  653. border: 1px solid #ffffff55;
  654. > i {
  655. color: #ffffff44;
  656. font-size: 16px;
  657. margin-left: 8px;
  658. margin-right: 10px;
  659. display: flex;
  660. align-items: center;
  661. justify-content: center;
  662. }
  663. > img {
  664. width: 14px;
  665. margin-left: 10px;
  666. margin-right: 12px;
  667. }
  668. `;
  669. const DeleteButton = styled.div`
  670. width: 15px;
  671. height: 15px;
  672. display: flex;
  673. align-items: center;
  674. margin-left: 8px;
  675. margin-top: -3px;
  676. justify-content: center;
  677. > i {
  678. font-size: 17px;
  679. color: #ffffff44;
  680. display: flex;
  681. align-items: center;
  682. justify-content: center;
  683. cursor: pointer;
  684. :hover {
  685. color: #ffffff88;
  686. }
  687. }
  688. `;
  689. const HideButton = styled(DeleteButton)`
  690. margin-top: -5px;
  691. > i {
  692. font-size: 19px;
  693. cursor: default;
  694. :hover {
  695. color: #ffffff44;
  696. }
  697. }
  698. `;
  699. const Wrapper = styled.div`
  700. margin-left: 5px;
  701. height: 20px;
  702. display: flex;
  703. align-items: center;
  704. margin-top: -7px;
  705. `;
  706. const InputWrapper = styled.div`
  707. display: flex;
  708. align-items: center;
  709. margin-top: 5px;
  710. `;
  711. type InputProps = {
  712. disabled?: boolean;
  713. width: string;
  714. borderColor?: string;
  715. };
  716. const Input = styled.input<InputProps>`
  717. outline: none;
  718. border: none;
  719. margin-bottom: 5px;
  720. font-size: 13px;
  721. background: #ffffff11;
  722. border: 1px solid
  723. ${(props) => (props.borderColor ? props.borderColor : "#ffffff55")};
  724. border-radius: 3px;
  725. width: ${(props) => (props.width ? props.width : "270px")};
  726. color: ${(props) => (props.disabled ? "#ffffff44" : "white")};
  727. padding: 5px 10px;
  728. height: 35px;
  729. `;
  730. const Label = styled.div`
  731. color: #ffffff;
  732. margin-bottom: 10px;
  733. `;
  734. const StyledInputArray = styled.div`
  735. margin-bottom: 15px;
  736. margin-top: 22px;
  737. `;
  738. const fadeIn = keyframes`
  739. from {
  740. opacity: 0;
  741. }
  742. to {
  743. opacity: 1;
  744. }
  745. `;
  746. const StyledCard = styled.div`
  747. border: 1px solid #ffffff44;
  748. background: #ffffff11;
  749. margin-bottom: 5px;
  750. border-radius: 8px;
  751. margin-top: 15px;
  752. padding: 10px 14px;
  753. overflow: hidden;
  754. font-size: 13px;
  755. animation: ${fadeIn} 0.5s;
  756. `;
  757. const Flex = styled.div`
  758. display: flex;
  759. height: 25px;
  760. align-items: center;
  761. justify-content: space-between;
  762. `;
  763. const ContentContainer = styled.div`
  764. display: flex;
  765. height: 40px;
  766. width: 100%;
  767. align-items: center;
  768. `;
  769. const EventInformation = styled.div`
  770. display: flex;
  771. flex-direction: column;
  772. justify-content: space-around;
  773. height: 100%;
  774. `;
  775. const EventName = styled.div`
  776. font-family: "Work Sans", sans-serif;
  777. font-weight: 500;
  778. color: #ffffff;
  779. `;
  780. const ActionContainer = styled.div`
  781. display: flex;
  782. align-items: center;
  783. white-space: nowrap;
  784. height: 100%;
  785. `;
  786. const ActionButton = styled.button`
  787. position: relative;
  788. border: none;
  789. background: none;
  790. color: white;
  791. padding: 5px;
  792. width: 30px;
  793. height: 30px;
  794. margin-left: 5px;
  795. display: flex;
  796. justify-content: center;
  797. align-items: center;
  798. border-radius: 50%;
  799. cursor: pointer;
  800. color: #aaaabb;
  801. border: 1px solid #ffffff00;
  802. :hover {
  803. background: #ffffff11;
  804. border: 1px solid #ffffff44;
  805. }
  806. > span {
  807. font-size: 20px;
  808. }
  809. `;