import React from 'react';
import styled from 'styled-components';

import type { IconProps } from '@redocly/theme/icons/types';

import { getCssColorVariable } from '@redocly/theme/core/utils';

const Icon = (props: IconProps) => (
  <svg viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg" {...props}>
    <path d="M14 15H2C1.73487 14.9997 1.48068 14.8943 1.2932 14.7068C1.10572 14.5193 1.00028 14.2651 1 14V10C1.00028 9.73487 1.10572 9.48068 1.2932 9.2932C1.48068 9.10572 1.73487 9.00028 2 9H14C14.2651 9.00028 14.5193 9.10572 14.7068 9.2932C14.8943 9.48068 14.9997 9.73487 15 10V14C14.9997 14.2651 14.8943 14.5193 14.7068 14.7068C14.5193 14.8943 14.2651 14.9997 14 15ZM2 10V14H14V10H2Z" />
    <path d="M14 7H2C1.73487 6.99972 1.48068 6.89428 1.2932 6.7068C1.10572 6.51932 1.00028 6.26513 1 6V2C1.00028 1.73487 1.10572 1.48068 1.2932 1.2932C1.48068 1.10572 1.73487 1.00028 2 1H14C14.2651 1.00028 14.5193 1.10572 14.7068 1.2932C14.8943 1.48068 14.9997 1.73487 15 2V6C14.9997 6.26513 14.8943 6.51932 14.7068 6.7068C14.5193 6.89428 14.2651 6.99972 14 7ZM2 2V6H14V2H2Z" />
  </svg>
);

export const HorizontalViewIcon = styled(Icon).attrs(() => ({
  'data-component-name': 'icons/HorizontalViewIcon/HorizontalViewIcon',
}))<IconProps>`
  path {
    fill: ${({ color }) => getCssColorVariable(color)};
  }

  height: ${({ size }) => size || '16px'};
  width: ${({ size }) => size || '16px'};
`;
