From: Daniel Karbach Date: Wed, 22 Feb 2023 21:39:52 +0000 (+0100) Subject: event corner images X-Git-Url: https://git.localhorst.tv/?a=commitdiff_plain;h=9b4ede72755930de6b0a39bf6f142e598c043844;p=alttp.git event corner images --- diff --git a/database/migrations/2023_02_22_212552_add_event_corner.php b/database/migrations/2023_02_22_212552_add_event_corner.php new file mode 100644 index 0000000..ff6b277 --- /dev/null +++ b/database/migrations/2023_02_22_212552_add_event_corner.php @@ -0,0 +1,32 @@ +string('corner')->default(''); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('events', function(Blueprint $table) { + $table->dropColumn('corner'); + }); + } +}; diff --git a/resources/js/components/episodes/Item.js b/resources/js/components/episodes/Item.js index 71fe49e..5f43c12 100644 --- a/resources/js/components/episodes/Item.js +++ b/resources/js/components/episodes/Item.js @@ -36,10 +36,19 @@ const Item = ({ episode, onAddRestream, onEditRestream, user }) => { classNames.push('is-active'); } + const style = React.useMemo(() => { + if (episode.event && episode.event.corner) { + return { + backgroundImage: `url(${episode.event.corner})`, + }; + } + return null; + }, [episode.event && episode.event.corner]); + const hasChannels = episode.channels && episode.channels.length; const hasPlayers = episode.players && episode.players.length; - return
+ return
{t('schedule.startTime', { date: new Date(episode.start) })}
@@ -99,6 +108,7 @@ Item.propTypes = { crew: PropTypes.arrayOf(PropTypes.shape({ })), event: PropTypes.shape({ + corner: PropTypes.string, title: PropTypes.string, }), players: PropTypes.arrayOf(PropTypes.shape({ diff --git a/resources/sass/episodes.scss b/resources/sass/episodes.scss index 3372257..df98cd7 100644 --- a/resources/sass/episodes.scss +++ b/resources/sass/episodes.scss @@ -9,6 +9,11 @@ } .episodes-item { + background-size: 6rem auto; + background-repeat: no-repeat; + background-position: left bottom; + min-height: 8rem; + &.is-active { border-color: $success !important; box-shadow: 0 0 0.25rem 0.25rem $success;