|
1 | 1 | import React from 'react'
|
2 | 2 | import { Link } from 'react-router-dom'
|
3 |
| -import styled from 'styled-components' |
4 |
| - |
5 |
| -const Container = styled.div` |
6 |
| - height: 272px; |
7 |
| - width: auto; |
8 |
| - background: rgba(24, 24, 24, 1); |
9 |
| - border-radius: 4px; |
10 |
| - box-shadow: 0 16px 24px rgba(0, 0, 0, 0.3); |
11 |
| - transition: all 0.25s; |
12 |
| - a { |
13 |
| - text-decoration: none; |
14 |
| - width: 100%; |
15 |
| - height: 100%; |
16 |
| - transition: all 0.25s; |
17 |
| - cursor: pointer; |
18 |
| - .poster { |
19 |
| - height: 70%; |
20 |
| - padding: 16px; |
21 |
| - img { |
22 |
| - box-shadow: 8px 8px 16px rgba(0, 0, 0, 0.3); |
23 |
| - border-radius: 2px; |
24 |
| - width: 100%; |
25 |
| - height: 100%; |
26 |
| - object-fit: cover; |
27 |
| - } |
28 |
| - } |
29 |
| - .meta { |
30 |
| - padding: 0 16px 16px 16px; |
31 |
| - h3 { |
32 |
| - font-size: 16px !important; |
33 |
| - color: rgba(255, 255, 255, 0.9); |
34 |
| - white-space: nowrap; |
35 |
| - text-overflow: ellipsis; |
36 |
| - overflow: hidden; |
37 |
| - } |
38 |
| - p { |
39 |
| - overflow: hidden; |
40 |
| - text-overflow: ellipsis; |
41 |
| - display: -webkit-box; |
42 |
| - -webkit-box-orient: vertical; |
43 |
| - line-clamp: 2; |
44 |
| - -webkit-line-clamp: 2; |
45 |
| - color: rgba(179, 179, 179, 0.9); |
46 |
| - font-weight: 500; |
47 |
| - } |
48 |
| - } |
49 |
| - } |
50 |
| - &:hover { |
51 |
| - background: rgba(179, 179, 179, 0.18); |
52 |
| - } |
53 |
| -`; |
54 |
| - |
55 |
| -export default function Frame({ children, playlist }) { |
56 |
| - // const { images } = playlist; |
| 3 | +// icons |
| 4 | +import { PlayIcon } from '../../helpers/icons' |
| 5 | +// styled-components |
| 6 | +import { Container } from './styles/frameStyles' |
57 | 7 |
|
| 8 | +export default function Frame({ children, items, ...props }) { |
58 | 9 | return children ? (
|
59 |
| - <Container> |
| 10 | + <Container {...props}> |
60 | 11 | {children}
|
61 | 12 | </Container>
|
62 | 13 | ) : (
|
63 | 14 | <Container>
|
64 |
| - <Link> |
| 15 | + <Link to={`/playlist/${items.id}`}> |
65 | 16 | <div className="poster">
|
66 |
| - <img src={playlist && playlist.images[0].url} alt={`${playlist.name}-poster`} /> |
| 17 | + <img src={items && items.images[0].url} alt={`${items.name}-poster`} loading="lazy" /> |
| 18 | + <button><PlayIcon /></button> |
67 | 19 | </div>
|
68 | 20 | <div className="meta">
|
69 |
| - <h3>{playlist && playlist.name}</h3> |
70 |
| - <p>{playlist && playlist.description}</p> |
| 21 | + <h3>{items && items.name}</h3> |
| 22 | + <p>{items && items.description}</p> |
71 | 23 | </div>
|
72 | 24 | </Link>
|
73 | 25 | </Container>
|
|
0 commit comments