Web: Management: added logic for displaying the portal icon, fixed styles

This commit is contained in:
DmitrySychugov 2023-07-31 19:25:43 +05:00
parent b25b0aed99
commit e55a914e1d

View File

@ -1,19 +1,21 @@
import React from "react"; import React from "react";
import Row from "@docspace/components/row"; import Row from "@docspace/components/row";
import { RoomContent } from "./RoomContent"; import { RoomContent } from "./RoomContent";
import { observer } from "mobx-react";
import styled from "styled-components"; import styled from "styled-components";
import CatalogSettingsReactSvgUrl from "PUBLIC_DIR/images/catalog.settings.react.svg?url"; import CatalogSettingsReactSvgUrl from "PUBLIC_DIR/images/catalog.settings.react.svg?url";
import DeleteReactSvgUrl from "PUBLIC_DIR/images/delete.react.svg?url"; import DeleteReactSvgUrl from "PUBLIC_DIR/images/delete.react.svg?url";
import ExternalLinkIcon from "PUBLIC_DIR/images/external.link.react.svg?url"; import ExternalLinkIcon from "PUBLIC_DIR/images/external.link.react.svg?url";
import { ReactSVG } from "react-svg"; import DefaultLogoUrl from "PUBLIC_DIR/images/logo/dark_lightsmall.svg?url";
import TestIcon from "PUBLIC_DIR/images/logo/dark_lightsmall.svg?url"; import { ReactSVG } from "react-svg";
import { useStore } from "SRC_DIR/store";
const StyledRoomRow = styled(Row)` const StyledRoomRow = styled(Row)`
padding: 6px 0; padding: 4px 0;
.styled-element { .styled-element {
width: 42px; width: 32px;
margin-left: 20px; margin-left: 20px;
} }
@ -21,9 +23,16 @@ const StyledRoomRow = styled(Row)`
margin-right: 8px; margin-right: 8px;
} }
`; `;
const SpacesRoomRow = ({ item }) => {
const { spacesStore } = useStore();
export const SpacesRoomRow = ({ item, deletePortal }) => { const { deletePortal, faviconLogo } = spacesStore;
const element = <ReactSVG id={item.key} src={TestIcon} />; // change icon
const logoElement = faviconLogo ? (
<img id={item.key} width={"32px"} height={"32px"} src={faviconLogo} />
) : (
<ReactSVG id={item.key} src={DefaultLogoUrl} />
);
const contextOptionsProps = [ const contextOptionsProps = [
{ {
@ -51,7 +60,7 @@ export const SpacesRoomRow = ({ item, deletePortal }) => {
return ( return (
<StyledRoomRow <StyledRoomRow
contextOptions={contextOptionsProps} contextOptions={contextOptionsProps}
element={element} element={logoElement}
key={item.id} key={item.id}
data={item} data={item}
> >
@ -59,3 +68,5 @@ export const SpacesRoomRow = ({ item, deletePortal }) => {
</StyledRoomRow> </StyledRoomRow>
); );
}; };
export default observer(SpacesRoomRow);