import styled, { css } from 'styled-components';
import { convertToTransientProps, getSpacing, getFontSize } from '../../../../utils/index.js';

const HeaderWrapper = styled.div.withConfig({
    shouldForwardProp: convertToTransientProps([
        'hasPullTab',
        'pinnedHeader',
    ]),
}) `
  --pull-tab-height: 20px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  border-radius: ${({ theme: { radius } }) => `${radius.roundedC} ${radius.roundedC} ${radius.roundedNone} ${radius.roundedNone}`};

  padding: ${getSpacing('s04', 's03')};

  ${({ hasPullTab }) => hasPullTab &&
    css `
      padding-top: calc(${getSpacing('s04')} + var(--pull-tab-height));
    `}

  ${({ pinnedHeader }) => pinnedHeader &&
    css `
      box-shadow: rgb(0 0 0 / 20%) 0px 5px 9px 3px;
    `}
`;
const HeaderInnerWrapper = styled.div `
  display: flex;
  justify-content: space-between;
  width: 100%;
`;
const IconTitleWrapper = styled.div.withConfig({
    shouldForwardProp: convertToTransientProps([
        'headerControlsModifiers',
    ]),
}) `
  display: flex;
  align-items: center;
  height: 35px;
  position: relative;

  width: ${({ headerControlsModifiers }) => headerControlsModifiers === 'close' ? 'calc(100% - 32px)' : '100%'};

  h3 {
    margin: 0;
    ${getFontSize('size20')};
    text-overflow: ellipsis;
    white-space: nowrap;
    overflow: hidden;
    text-align: left;
  }

  svg {
    margin-right: ${getSpacing('s04')};
    min-width: 20px;
  }
`;

export { HeaderInnerWrapper, HeaderWrapper, IconTitleWrapper };
