import * as React from "react"; import { get, has } from "lodash"; // import { Link } from "react-router-dom"; import styled from "styled-components"; import { LinkDisplayTypes, LinkLayoutStyles } from "./types"; import { Button, ListItem } from "../"; import { IconSource } from "../Icon/types"; import { EditorMode } from "@sc/modules/v2/Editor/types"; import presets from "@sc/plugins/webcomponents/v2/Button/presets"; interface LinkProps { mode?: EditorMode; filter?: any; items: any[]; linkStyle: any; showSocial?: boolean; style?: any; layoutStyle?: LinkLayoutStyles; } const Link = (props) => {props.children}; export const Links: React.FC = ({ filter, items, linkStyle, showSocial, style, layoutStyle = LinkLayoutStyles.HORIZONTAL, mode = EditorMode.LIVE, }) => { let links = items; if (filter) links = items.filter((itm) => itm.column === filter); // display: inline-block; const LI = styled.li` &:hover { text-decoration: underline; } `; const OptionallyRenderAsLink = (props) => { if (mode === EditorMode.EDITOR) return props.children; return ; }; return (
{links.map((itm) => { if (get(itm, "type", LinkDisplayTypes.TEXT) === LinkDisplayTypes.TEXT) { return (
  • {itm.caption}
  • ); } if (get(itm, "type") === LinkDisplayTypes.ICON) { return ( {itm.caption} ); } if (get(itm, "type") === LinkDisplayTypes.BUTTON) { return (
  • ); } })}
    ); };