import React from "react";
import styled from "styled-components";
import { getLinkColors } from "./getLinkStyle";
import { ctaIconSize, ctaTextType } from "../getCtaStyle";
import { Text } from "../../asorted";
import baseStyled from "../../styled";
export const DEFAULT_ICON_POSITION = "right";
export const DEFAULT_SIZE = "medium";
export const DEFAULT_TYPE = "main";
const IconContainer = styled.div `
  ${p => (p.iconLink ? "" : p.iconPosition === "left" ? `margin-right: 6px;` : `margin-left: 6px;`)}
  display: flex;
  align-items: center;
  justify-content: center;
`;
export const Base = baseStyled.a `
  color: ${({ color, theme, disabled, type = "main" }) => color || getLinkColors(theme.colors)[disabled ? "disabled" : type]["default"]};
  cursor: pointer;
  display: inline-flex;
  flex-direction: row;
  text-align: center;
  align-items: center;
  justify-content: center;

  :hover {
    text-decoration: underline;
  }
  :active {
    color: ${({ color, theme, type = "main" }) => color || getLinkColors(theme.colors)[type]["pressed"]};
    text-decoration: underline;
  }

  text-decoration: ${p => (p.alwaysUnderline ? "underline" : "none")};

`;
const LinkContainer = ({ Icon, iconPosition = DEFAULT_ICON_POSITION, children, color, size = DEFAULT_SIZE, textProps, }) => {
    const text = (React.createElement(Text, Object.assign({ variant: ctaTextType[size], fontWeight: "semiBold", color: color || "inherit" }, textProps), children));
    return (React.createElement(React.Fragment, null,
        iconPosition === "right" && children ? text : null,
        Icon ? (React.createElement(IconContainer, { iconLink: !children, iconPosition: iconPosition },
            React.createElement(Icon, { size: ctaIconSize[size], color: color || "currentcolor" }))) : null,
        iconPosition === "left" && children ? text : null));
};
const Link = (props) => {
    const { type = DEFAULT_TYPE, size = DEFAULT_SIZE, color } = props;
    return (React.createElement(Base, Object.assign({ color: color }, props),
        React.createElement(LinkContainer, Object.assign({}, props, { type: type, size: size }))));
};
export default Link;
//# sourceMappingURL=index.js.map