ChannelView.style.tsx 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. import styled from '@emotion/styled'
  2. import { fluidRange } from 'polished'
  3. import { Avatar, Placeholder } from '@/shared/components'
  4. import theme, { breakpoints } from '@/shared/theme'
  5. import { css } from '@emotion/core'
  6. const SM_TITLE_HEIGHT = '48px'
  7. const TITLE_HEIGHT = '56px'
  8. type CoverImageProps = {
  9. src: string
  10. }
  11. export const Header = styled.section`
  12. position: relative;
  13. margin-bottom: 60px;
  14. @media screen and (min-width: ${breakpoints.small}) {
  15. margin-bottom: -75px;
  16. padding-bottom: 0;
  17. }
  18. @media screen and (min-width: ${breakpoints.medium}) {
  19. margin-bottom: -200px;
  20. }
  21. @media screen and (min-width: ${breakpoints.large}) {
  22. margin-bottom: -250px;
  23. }
  24. @media screen and (min-width: ${breakpoints.xlarge}) {
  25. margin-bottom: -400px;
  26. }
  27. @media screen and (min-width: ${breakpoints.xxlarge}) {
  28. margin-bottom: -600px;
  29. }
  30. `
  31. export const MediaWrapper = styled.div`
  32. margin: 0 calc(-1 * var(--global-horizontal-padding));
  33. width: calc(100% + calc(2 * var(--global-horizontal-padding)));
  34. `
  35. export const CoverImage = styled.div<CoverImageProps>`
  36. width: 100%;
  37. height: 0;
  38. padding-top: 56.25%;
  39. background-repeat: no-repeat;
  40. background-position: center;
  41. background-attachment: local;
  42. background-size: cover;
  43. background-image: linear-gradient(0deg, black 0%, rgba(0, 0, 0, 0) 40%), url(${({ src }) => src});
  44. @media screen and (min-width: ${breakpoints.small}) {
  45. background-image: linear-gradient(0deg, black 0%, rgba(0, 0, 0, 0) 80%), url(${({ src }) => src});
  46. }
  47. @media screen and (min-width: ${breakpoints.medium}) {
  48. background-image: linear-gradient(0deg, black 0%, black 10%, rgba(0, 0, 0, 0) 70%), url(${({ src }) => src});
  49. }
  50. @media screen and (min-width: ${breakpoints.large}) {
  51. background-image: linear-gradient(0deg, black 0%, black 20%, rgba(0, 0, 0, 0) 90%), url(${({ src }) => src});
  52. }
  53. @media screen and (min-width: ${breakpoints.xlarge}) {
  54. background-image: linear-gradient(0deg, black 0%, black 30%, rgba(0, 0, 0, 0) 90%), url(${({ src }) => src});
  55. }
  56. @media screen and (min-width: ${breakpoints.xxlarge}) {
  57. background-image: linear-gradient(0deg, black 0%, black 40%, rgba(0, 0, 0, 0) 90%), url(${({ src }) => src});
  58. }
  59. `
  60. export const TitleSection = styled.div`
  61. position: absolute;
  62. display: flex;
  63. flex-direction: column;
  64. align-items: start;
  65. @media (min-width: ${theme.breakpoints.small}) {
  66. flex-direction: row;
  67. align-items: center;
  68. }
  69. width: 100%;
  70. max-width: 100%;
  71. top: 5%;
  72. @media screen and (min-width: ${breakpoints.small}) {
  73. top: 20%;
  74. }
  75. `
  76. export const TitleContainer = styled.div`
  77. max-width: 100%;
  78. @media screen and (min-width: ${theme.breakpoints.medium}) {
  79. max-width: 60%;
  80. }
  81. background-color: ${theme.colors.gray[800]};
  82. padding: 0 ${theme.sizes.b2}px;
  83. `
  84. export const Title = styled.h1`
  85. ${fluidRange({ prop: 'fontSize', fromSize: '32px', toSize: '40px' })};
  86. font-weight: bold;
  87. margin: -4px 0 0;
  88. line-height: ${SM_TITLE_HEIGHT};
  89. @media screen and (min-width: ${theme.breakpoints.medium}) {
  90. line-height: ${TITLE_HEIGHT};
  91. }
  92. white-space: nowrap;
  93. text-overflow: ellipsis;
  94. overflow-x: hidden;
  95. max-width: 100%;
  96. `
  97. export const VideoSection = styled.section`
  98. position: relative;
  99. `
  100. const avatarCss = css`
  101. width: 128px;
  102. height: 128px;
  103. margin-bottom: ${theme.sizes.b3}px;
  104. @media (min-width: ${theme.breakpoints.small}) {
  105. width: 136px;
  106. height: 136px;
  107. margin: 0 ${theme.sizes.b6}px 0 0;
  108. }
  109. `
  110. export const StyledAvatar = styled(Avatar)`
  111. ${avatarCss};
  112. `
  113. export const AvatarPlaceholder = styled(Placeholder)`
  114. ${avatarCss};
  115. border-radius: 100%;
  116. `
  117. export const TitlePlaceholder = styled(Placeholder)`
  118. width: 300px;
  119. height: ${SM_TITLE_HEIGHT};
  120. @media screen and (min-width: ${theme.breakpoints.medium}) {
  121. height: ${TITLE_HEIGHT};
  122. }
  123. `