From c09aab34ea5af6a678aedc4e058af9fae0434ce4 Mon Sep 17 00:00:00 2001 From: Daniel Cortes Date: Mon, 15 Jun 2020 02:04:17 -0400 Subject: [PATCH] Creacion de entitylist generica --- src/components/EntityList.jsx | 43 ++++++++++ src/components/EntityList.scss | 140 +++++++++++++++++++++++++++++++++ src/components/Search.jsx | 2 +- src/index.jsx | 2 + src/styles/main.scss | 140 ++++++++++++++++----------------- 5 files changed, 256 insertions(+), 71 deletions(-) create mode 100644 src/components/EntityList.jsx create mode 100644 src/components/EntityList.scss diff --git a/src/components/EntityList.jsx b/src/components/EntityList.jsx new file mode 100644 index 0000000..32e089b --- /dev/null +++ b/src/components/EntityList.jsx @@ -0,0 +1,43 @@ +import React, {Fragment, useEffect, useState} from "react"; +import {Link} from "react-router-dom"; + +import {CoverArt} from "./CoverArt"; +import "./EntityList.scss" + +const EntityItem = (props) => { + const disc = { + 'id': '061f572e-7660-3c6b-b4cd-cf66d46da93c', + } + return ( +
  • + + {props.cover && +
    + +
    + } +
    + {props.title} + {props.subtitle} +
    + +
  • + ) +} + +export const EntityList = (props) => { + return ( + + ) +} diff --git a/src/components/EntityList.scss b/src/components/EntityList.scss new file mode 100644 index 0000000..65e884c --- /dev/null +++ b/src/components/EntityList.scss @@ -0,0 +1,140 @@ +// Base +.entity_list { + .entity { + a { + text-decoration: none; + color: var(--black); + + .cover { + width: 200px; + height: 200px; + background-color: var(--gray-2); + margin-right: 1em; + } + + .body { + .title { + font-weight: 500; + } + .subtitle { + font-size: .8em; + } + } + } + } +} + +// Column mode +.entity_list.column { + display: flex; + flex-direction: column; + + .entity a { + display: flex; + flex-direction: row; + align-items: center; + padding: 1em 2em; + .body { + display: flex; + flex-direction: column; + } + } +} + +// Grid mode +.entity_list.grid { + $grid-width: 250px; + $grid-height: 275px; + $grid-gap: 20px; + + display: grid; + + grid-auto-rows: $grid-height; + gap: $grid-gap; + + justify-content: center; + + @for $x from 1 to 5 { + @media (min-width: $grid-width * $x + $grid-gap * 3) { + grid-template-columns: repeat($x, $grid-width); + } + } + + @media (min-width: $grid-width * 4 + $grid-gap * 3) { + justify-content: space-between; + } + + .entity { + a { + .cover { + width: 250px; + height: 250px; + } + + .body { + height: 15px; + .title { + max-width: 250px; + display: inline-block; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + } + .subtitle { + display: none; + } + } + } + } +} + +// Highligth Column +.entity_list.column{ + .entity { + border-bottom: solid var(--line-width) var(--gray-1); + transition: background-color 300ms ease-in; + + &:after{ + display: block; + content: ''; + border-bottom: solid var(--line-width) var(--accent); + transition: width 300ms ease-in; + width: 0; + } + + &:hover { + &:after{ + width: 100%; + } + background-color: var(--gray-1); + } + } +} + +// Highligth Grid +.entity_list.grid{ + .entity { + .body .title:after { + display: block; + content: ''; + border-bottom: solid var(--line-width) var(--accent); + transition: width 300ms ease-in; + width: 0; + } + + .cover { + outline: none; + transition: all 300ms ease-in-out; + } + + &:hover { + .cover { + outline: 6px var(--accent) solid; + outline-offset: -6px; + } + .body .title:after { + width: 100%; + } + } + } +} diff --git a/src/components/Search.jsx b/src/components/Search.jsx index 96dfb6c..7579ae8 100644 --- a/src/components/Search.jsx +++ b/src/components/Search.jsx @@ -24,7 +24,7 @@ const SearchSong = (props) => {
    {song.title} - {song.artist[0].name} + {song.artist.name}
    diff --git a/src/index.jsx b/src/index.jsx index f14c7ec..fb22238 100644 --- a/src/index.jsx +++ b/src/index.jsx @@ -2,6 +2,7 @@ import React, {Fragment} from 'react'; import ReactDOM from 'react-dom'; import {Search} from './components/Search'; import {SearchBar} from "./components/SearchBar"; +import {EntityList} from "./components/EntityList"; import './styles/reset.css'; import './styles/main.scss'; @@ -40,6 +41,7 @@ const App = () => ( + diff --git a/src/styles/main.scss b/src/styles/main.scss index a55f0d3..832456b 100644 --- a/src/styles/main.scss +++ b/src/styles/main.scss @@ -214,76 +214,76 @@ ul.pagination { } /* Lista de entidades */ -ul.entity_list { - display: flex; - flex-direction: column; - - li.artist, li.disc, li.song { - border-bottom: var(--line-width) var(--gray-1) solid; - margin-bottom: 1em; - - .cover-container { - width: 200px; - height: 200px; - margin: 1em; - } - - &:last-child { - margin-bottom: auto; - } - - &:hover { - background-color: var(--gray-1); - border-bottom: var(--line-width) var(--accent) solid; - } - - a { - display: flex; - text-decoration: none; - color: var(--black); - align-items: center; - height: 100%; - - .description { - display: flex; - flex-direction: column; - justify-content: center; - padding-left: 1em; - - .small { - color: var(--gray-4); - font-size: .8em; - } - } - - } - } - - li.artist { - height: 4em; - } - - li.disc { - height: 14em; - - a { - .release-date { - display: inline-block; - font-size: .7em; - background-color: var(--gray-4);; - color: var(--white); - padding: .1rem .5em; - border-radius: .25em; - text-align: center; - line-height: 1; - } - } - } - - li.song { - height: 4em; - } -} +// ul.entity_list { +// display: flex; +// flex-direction: column; +// +// li.artist, li.disc, li.song { +// border-bottom: var(--line-width) var(--gray-1) solid; +// margin-bottom: 1em; +// +// .cover-container { +// width: 200px; +// height: 200px; +// margin: 1em; +// } +// +// &:last-child { +// margin-bottom: auto; +// } +// +// &:hover { +// background-color: var(--gray-1); +// border-bottom: var(--line-width) var(--accent) solid; +// } +// +// a { +// display: flex; +// text-decoration: none; +// color: var(--black); +// align-items: center; +// height: 100%; +// +// .description { +// display: flex; +// flex-direction: column; +// justify-content: center; +// padding-left: 1em; +// +// .small { +// color: var(--gray-4); +// font-size: .8em; +// } +// } +// +// } +// } +// +// li.artist { +// height: 4em; +// } +// +// li.disc { +// height: 14em; +// +// a { +// .release-date { +// display: inline-block; +// font-size: .7em; +// background-color: var(--gray-4);; +// color: var(--white); +// padding: .1rem .5em; +// border-radius: .25em; +// text-align: center; +// line-height: 1; +// } +// } +// } +// +// li.song { +// height: 4em; +// } +// } .cover-caption { figcaption {