var __defProp = Object.defineProperty;
var __defProps = Object.defineProperties;
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __propIsEnum = Object.prototype.propertyIsEnumerable;
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __spreadValues = (a, b) => {
  for (var prop in b || (b = {}))
    if (__hasOwnProp.call(b, prop))
      __defNormalProp(a, prop, b[prop]);
  if (__getOwnPropSymbols)
    for (var prop of __getOwnPropSymbols(b)) {
      if (__propIsEnum.call(b, prop))
        __defNormalProp(a, prop, b[prop]);
    }
  return a;
};
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
var __objRest = (source, exclude) => {
  var target = {};
  for (var prop in source)
    if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
      target[prop] = source[prop];
  if (source != null && __getOwnPropSymbols)
    for (var prop of __getOwnPropSymbols(source)) {
      if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
        target[prop] = source[prop];
    }
  return target;
};
import { jsx, jsxs } from "react/jsx-runtime";
import React from "react";
import styled, { withTheme, css } from "styled-components";
import { shape, string } from "prop-types";
import { Time } from "@gympass/yoga-icons";
import Card from "../Card";
import { TextRenderer, Text } from "../../../Text/web/Text";
const Event = styled(Card).attrs({ hasShadow: false })`
  display: flex;
  flex-direction: row;

  width: 100%;
  padding: 0;
  overflow: hidden;
`;
const EventInfo = styled.div`
  ${({
  theme: {
    yoga: {
      borders,
      colors,
      components: {
        card: { event, radii }
      }
    }
  }
}) => css`
    padding: ${event.info.padding.top}px ${event.info.padding.right}px
      ${event.info.padding.bottom}px ${event.info.padding.left}px;

    border: ${borders.small}px solid ${colors.elements.lineAndBorders};
    border-top-right-radius: ${radii}px;
    border-bottom-right-radius: ${radii}px;

    ${TextRenderer}, ${Text.Small} {
      display: -webkit-inline-box;
      overflow: hidden;

      -webkit-line-clamp: 1;
      -webkit-box-orient: vertical;
      text-overflow: ellipsis;
      text-overflow: -o-ellipsis-lastline;
    }

    ${TextRenderer} {
      height: ${event.info.name.height}px;
      margin-bottom: ${event.info.name.marginBottom}px;

      font-weight: ${event.info.name.fontWeight};
      font-size: ${event.info.name.fontSize}px;
    }

    ${Text.Small} {
      height: ${event.info.place.height}px;
      margin-bottom: ${event.info.place.marginBottom}px;

      color: ${event.info.place.color};
      font-weight: ${event.info.name.fontWeight};
    }
  `}
`;
const EventTime = styled.div`
  display: flex;
  align-items: center;
`;
const DateInfo = styled.div`
  ${({
  theme: {
    yoga: {
      borders,
      components: {
        card: { event, radii }
      }
    }
  }
}) => `
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;

    width: 56px;
    background-color: ${event.date.backgroundColor};
    border: ${borders.small}px solid ${event.date.backgroundColor};
    border-top-left-radius: ${radii}px;
    border-bottom-left-radius: ${radii}px;
  `}
`;
const DayOfWeek = styled(Text.Small)`
  ${({
  theme: {
    yoga: {
      components: {
        card: { event }
      }
    }
  }
}) => `
    margin-bottom: ${event.date.dayOfWeek.marginBottom}px;

    font-weight: ${event.date.dayOfWeek.fontWeight};
  `}
`;
const Month = styled(Text.Small)`
  ${({
  theme: {
    yoga: {
      components: {
        card: { event }
      }
    }
  }
}) => `
    font-weight: ${event.date.month.fontWeight};
  `}
`;
const EventCard = (_a) => {
  var _b = _a, {
    event,
    date,
    theme: {
      yoga: {
        components: {
          card: {
            event: { icon }
          }
        }
      }
    }
  } = _b, rest = __objRest(_b, [
    "event",
    "date",
    "theme"
  ]);
  return /* @__PURE__ */ jsxs(Event, __spreadProps(__spreadValues({}, rest), { children: [
    /* @__PURE__ */ jsxs(DateInfo, { children: [
      /* @__PURE__ */ jsx(DayOfWeek, { inverted: true, children: date.dayOfWeek }),
      /* @__PURE__ */ jsx(Text.H5, { inverted: true, children: date.day }),
      /* @__PURE__ */ jsx(Month, { inverted: true, children: date.month })
    ] }),
    /* @__PURE__ */ jsxs(EventInfo, { children: [
      /* @__PURE__ */ jsx(Text, { as: "h3", title: event.name, children: event.name }),
      /* @__PURE__ */ jsx(Text.Small, { title: event.place, children: event.place }),
      /* @__PURE__ */ jsxs(EventTime, { children: [
        /* @__PURE__ */ jsx(Time, { fill: icon.fill, style: { marginRight: 5 } }),
        /* @__PURE__ */ jsx(Text.Tiny, { children: event.time })
      ] })
    ] })
  ] }));
};
EventCard.propTypes = {
  /** event information: { name (string), place (string), time (string) } */
  event: shape({
    name: string,
    place: string,
    time: string
  }).isRequired,
  /** date information: { day (string), dayOfWeek (string), month (string) } */
  date: shape({
    day: string,
    dayOfWeek: string,
    month: string
  }).isRequired
};
EventCard.displayName = "EventCard";
var EventCard_default = withTheme(EventCard);
export {
  EventCard_default as default
};
