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

const Table = ({ children, columns = "1fr 1fr 1fr 45%" }) => {
  return <Container columns={columns}>{children}</Container>;
};

export default Table;

const Container = styled.div`
  border: 1px solid #f5f7f7;
  border-radius: 25px;
  overflow: hidden;
  .lowercase {
    text-transform: lowercase;
  }
  .table_header,
  .table_body {
    grid-template-columns: ${(props) => props.columns};
    gap: 32px;
    padding-left: 20px;
    padding-right: 20px;
    display: grid;
    align-items: center;
  }

  .table_body {
    padding-top: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid #f5f7f7;
    &:last-child {
      border-bottom: none;
    }

    .feedback {
      width: 100%;
      display: flex;
      flex-direction: column;
      gap: 4px;
      .feedback_header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        width: 100%;
        padding: 0 8px;
        border-radius: 8px;
        background: rgba(254, 191, 16, 0.1);
        min-height: 26px;
        .feedback_header-content {
          display: flex;
          align-items: center;
          gap: 20px;
        }
      }
    }

    .bad {
      color: #f95454;
    }
    .good {
      color: #30d468;
    }
    .active {
      color: #00c2c2;
    }
    .yellow {
      color: #febf10;
    }
    .semi-bold {
      font-weight: 600;
    }
    p {
      font-size: 14px;
      font-weight: 400;

      &.status {
        border-radius: 32px;
        background: #e0f9e8;
        width: 80px;
        height: 30px;
        display: grid;
        place-items: center;
        font-size: 14px;
        color: #30d468;
        &.warning {
          background-color: #fef1cb;
          color: #f39b33;
        }
        &.failed {
          background-color: #f5e5e5;
          color: #f95454;
        }
      }
    }
  }
  .table_row {
    display: flex;
    flex-direction: column;
    width: 100%;
  }
  .space-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
  }
  .table_header {
    height: 52px;
    align-items: center;
    background: #f5f7f7;
    padding-top: 10px;
    padding-bottom: 10px;
    span {
      color: #878787;
      font-size: 14px;
      font-weight: 600;
    }
  }
`;
