---
const { json, lang, list } = Astro.props
import Img from '@/components/children/Img.astro'
import Text from '@/components/children/Text.astro'
// const value = {
//   id: '1',
//   url: 'https://e.huawei.com/-/mediae/images/solutions/computing/ascend-computing/ascend-computing-case-1.jpg',
//   title: '制造、AI开发平台 AI淬炼传统经验，让美味代代相传',
//   content:
//     '为生产优质香料和调料，提高公司竞争力，HEXA FOOD走上了数字化转型之路。通过使用华为云ModelArts一站式AI开发平台和Atlas 500智能小站，实现了辣椒智能分拣，筛选出优质原料，大幅提升了香料生产效率和品质',
// }
---

<!-- 左图右文 -->
<div class="container">
  <div class="row">
    <div class="col-sm-12 col-md-12 my-5">
      <div class="card border-0">
        <div
          class="left-right-card"
          style={list?.id ? 'cursor: pointer' : ''}
          data-post={list?.id}
        >
          <div class="row g-0">
            <div class="col-md-6 col-sm-6">
              <Img url={list?.url} ratio="3 / 2" />
            </div>
            <div class="col-md-6 col-sm-6">
              <div class="card-body pt-0 px-5">
                <Text
                  list={list}
                  btnDisplay={true}
                  ellipsis="line-ellipsis-large"
                />
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</div>
<style></style>
<script>
  const path = window.location.pathname
  var lang = path.substring(1, 3)

  const items = document.querySelectorAll(`.left-right-card`)
  items.forEach((item) => {
    item.addEventListener('click', () => {
      window.location.href = `${window.location.origin}/${lang}/detail?id=${item.dataset.post}`
    })
  })
</script>
