Updated file card styles in Koenig (#2175)

Added styles for file card in editor
This commit is contained in:
Peter Zimon 2021-12-10 19:17:11 +01:00 committed by GitHub
parent 10f7ca4019
commit 6800a3fdb4
6 changed files with 114 additions and 77 deletions

View File

@ -1937,38 +1937,18 @@ button.emoji-picker__category-button.active {
margin-top: 20px; margin-top: 20px;
} }
/* File card
/* Upload cards: audio and file
/* --------------------------------------------------------------- */ /* --------------------------------------------------------------- */
.kg-file-data-container { .kg-upload-container {
position: relative;
display: flex;
flex-direction: column;
width: 100%;
}
.kg-file-data-container input {
padding-top: 0;
padding-bottom: 0;
height: 24px;
}
.kg-file-data-container .kg-file-card-caption {
margin-top: 0;
}
/* Audio card
/* --------------------------------------------------------------- */
.kg-audio-container {
display: flex; display: flex;
width: 100%; width: 100%;
border-radius: var(--border-radius); border-radius: var(--border-radius);
box-shadow: inset 0 0 0 1px rgba(124, 139, 154, 0.25); box-shadow: inset 0 0 0 1px rgba(124, 139, 154, 0.25);
} }
.kg-audio-container-empty { .kg-upload-container-empty {
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
@ -1977,7 +1957,7 @@ button.emoji-picker__category-button.active {
cursor: pointer; cursor: pointer;
} }
.kg-audio-container-empty svg { .kg-upload-container-empty svg {
width: 24px; width: 24px;
height: auto; height: auto;
margin-right: 8px; margin-right: 8px;
@ -1987,17 +1967,17 @@ button.emoji-picker__category-button.active {
transform: scale(1.0); transform: scale(1.0);
} }
.kg-audio-container-empty:hover svg { .kg-upload-container-empty:hover svg {
opacity: 1.0; opacity: 1.0;
transform: scale(1.04); transform: scale(1.04);
} }
.kg-audio-container-empty .gh-progress-container-progress { .kg-upload-container-empty .gh-progress-container-progress {
width: 30%; width: 30%;
background: linear-gradient(to bottom, var(--whitegrey-l1), var(--whitegrey)); background: linear-gradient(to bottom, var(--whitegrey-l1), var(--whitegrey));
} }
.kg-placeholder-text { .kg-upload-placeholder-text {
color: var(--midgrey); color: var(--midgrey);
font-family: var(--font-family); font-family: var(--font-family);
font-size: 1.45rem; font-size: 1.45rem;
@ -2005,7 +1985,7 @@ button.emoji-picker__category-button.active {
line-height: 1.6em; line-height: 1.6em;
} }
.kg-audio-container-empty:hover .kg-placeholder-text { .kg-upload-container-empty:hover .kg-upload-placeholder-text {
color: var(--midgrey-d2); color: var(--midgrey-d2);
} }
@ -2022,11 +2002,16 @@ button.emoji-picker__category-button.active {
border-radius: var(--border-radius); border-radius: var(--border-radius);
} }
.kg-media-container.light {
background: var(--whitegrey);
color: var(--pink);
}
.kg-media-container .gh-progress-container-progress { .kg-media-container .gh-progress-container-progress {
background: rgba(225, 225, 225, .2); background: rgba(225, 225, 225, .2);
} }
.kg-audio-button { .kg-upload-button {
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
@ -2034,8 +2019,8 @@ button.emoji-picker__category-button.active {
height: 80px; height: 80px;
} }
.kg-audio-button .koenig-audio-replace-icon, .kg-upload-button .koenig-audio-replace-icon,
.kg-audio-button .koenig-audio-upload-icon { .kg-upload-button .koenig-audio-upload-icon {
width: 18px; width: 18px;
height: 18px; height: 18px;
margin: .6rem .8rem; margin: .6rem .8rem;
@ -2046,7 +2031,7 @@ button.emoji-picker__category-button.active {
stroke-width: 2; stroke-width: 2;
} }
.kg-audio-button .image-overlay { .kg-upload-button .image-overlay {
position: absolute; position: absolute;
top: 0; top: 0;
right: 0; right: 0;
@ -2057,30 +2042,30 @@ button.emoji-picker__category-button.active {
background-image: linear-gradient(180deg,rgba(0,0,0,0.2) 0,transparent 70%,transparent 100%); background-image: linear-gradient(180deg,rgba(0,0,0,0.2) 0,transparent 70%,transparent 100%);
opacity: 0; opacity: 0;
transition: all 0.15s ease-in-out; transition: all 0.15s ease-in-out;
} }
.kg-audio-button:hover .image-overlay { .kg-upload-button:hover .image-overlay {
opacity: 1; opacity: 1;
} }
.kg-audio-button .kg-audio-icon { .kg-upload-button .kg-audio-icon {
width: 24px; width: 24px;
height: 24px; height: 24px;
fill: var(--white); fill: var(--white);
transition: all 0.15s ease-in-out; transition: all 0.15s ease-in-out;
} }
.kg-audio-button:hover .kg-audio-icon { .kg-upload-button:hover .kg-audio-icon {
opacity: .6; opacity: .6;
} }
.kg-audio-button img { .kg-upload-button img {
width: 100%; width: 100%;
height: 100%; height: 100%;
object-fit: cover; object-fit: cover;
border-radius: var(--border-radius); border-radius: var(--border-radius);
background: var(--white); background: var(--white);
} }
.kg-player-container { .kg-player-container {
position: relative; position: relative;
@ -2090,7 +2075,8 @@ button.emoji-picker__category-button.active {
width: 100%; width: 100%;
} }
.kg-audio-title { .kg-upload-title,
.kg-upload-caption {
width: 100%; width: 100%;
margin: 8px 0 0 0; margin: 8px 0 0 0;
padding: 8px 12px; padding: 8px 12px;
@ -2100,10 +2086,30 @@ button.emoji-picker__category-button.active {
background: transparent; background: transparent;
} }
.kg-audio-title:focus { .kg-upload-title:focus,
.kg-upload-caption:focus {
box-shadow: none; box-shadow: none;
} }
.kg-upload-caption {
font-size: 1.4rem;
font-weight: 500;
color: var(--midgrey);
margin-top: 4px;
}
.kg-upload-metadata {
line-height: 1em;
margin: 0 12px 14px;
font-size: 1.4rem;
font-weight: 500;
}
.kg-upload-filesize {
color: var(--midgrey);
font-weight: 400;
}
.kg-audio-current-time { .kg-audio-current-time {
min-width: 38px; min-width: 38px;
padding: 0 4px; padding: 0 4px;
@ -2201,6 +2207,31 @@ button.emoji-picker__category-button.active {
border-radius: 2px; border-radius: 2px;
} }
.kg-file-data-container {
position: relative;
display: flex;
flex-direction: column;
width: 100%;
justify-content: space-between;
}
.kg-file-data-container .kg-upload-title {
padding-top: 4px;
padding-bottom: 0px;
height: 30px;
}
.kg-file-data-container .kg-upload-caption {
padding-top: 0;
height: 26px;
margin-top: 0px;
font-weight: 400;
}
.kg-file-data-container .kg-file-card-caption {
margin-top: 0;
}
/* Video card /* Video card
/* --------------------------------------------------------------- */ /* --------------------------------------------------------------- */

View File

@ -1,6 +1,6 @@
<KoenigCard <KoenigCard
@env={{@env}} @env={{@env}}
@class={{"ba b--transparent relative kg-card-hover kg-card kg-audio-card mih10 miw-100 relative" (kg-style "breakout" size=@payload.cardWidth)}} @class={{"ba b--transparent relative kg-card-hover kg-card kg-upload-card mih10 miw-100 relative" (kg-style "breakout" size=@payload.cardWidth)}}
@headerOffset={{@headerOffset}} @headerOffset={{@headerOffset}}
@toolbar={{this.toolbar}} @toolbar={{this.toolbar}}
@payload={{@payload}} @payload={{@payload}}
@ -23,7 +23,7 @@
as |card| as |card|
> >
{{#if @payload.src}} {{#if @payload.src}}
<div class="kg-audio-container"> <div class="kg-upload-container">
<div class="kg-media-container"> <div class="kg-media-container">
<GhUploader <GhUploader
@uploadUrl="/media/thumbnail/upload/" @uploadUrl="/media/thumbnail/upload/"
@ -52,11 +52,11 @@
{{else if uploader.isUploading}} {{else if uploader.isUploading}}
{{uploader.progressBar}} {{uploader.progressBar}}
{{else if (not @payload.thumbnailSrc)}} {{else if (not @payload.thumbnailSrc)}}
<button class="kg-audio-button" {{on "click" this.triggerThumbnailFileDialog}}> <button class="kg-upload-button" {{on "click" this.triggerThumbnailFileDialog}}>
{{svg-jar "audio-upload"}} {{svg-jar "audio-upload"}}
</button> </button>
{{else}} {{else}}
<button class="kg-audio-button" {{on "click" this.triggerThumbnailFileDialog}}> <button class="kg-upload-button" {{on "click" this.triggerThumbnailFileDialog}}>
<img src={{@payload.thumbnailSrc}} class="{{kg-style this.kgImgStyle}}"> <img src={{@payload.thumbnailSrc}} class="{{kg-style this.kgImgStyle}}">
{{!-- <span class="mt2 midgrey">Click to select an audio</span> --}} {{!-- <span class="mt2 midgrey">Click to select an audio</span> --}}
</button> </button>
@ -74,7 +74,7 @@
{{else if uploader.isUploading}} {{else if uploader.isUploading}}
{{uploader.progressBar}} {{uploader.progressBar}}
{{else if @payload.thumbnailSrc}} {{else if @payload.thumbnailSrc}}
<div class="kg-audio-button"> <div class="kg-upload-button">
<img src={{@payload.thumbnailSrc}} /> <img src={{@payload.thumbnailSrc}} />
<div class="image-overlay"> <div class="image-overlay">
<div class="flex flex-row-reverse"> <div class="flex flex-row-reverse">
@ -85,7 +85,7 @@
</div> </div>
</div> </div>
{{else}} {{else}}
<button class="kg-audio-button" {{on "click" this.triggerThumbnailFileDialog}}> <button class="kg-upload-button" {{on "click" this.triggerThumbnailFileDialog}}>
{{svg-jar "audio-file" class="kg-audio-icon"}} {{svg-jar "audio-file" class="kg-audio-icon"}}
<div class="image-overlay"> <div class="image-overlay">
<div class="flex flex-row-reverse"> <div class="flex flex-row-reverse">
@ -112,7 +112,7 @@
<GhTextInput <GhTextInput
@value={{@payload.title}} @value={{@payload.title}}
@input={{action "setAudioTitle" value="target.value"}} @input={{action "setAudioTitle" value="target.value"}}
@class="kg-audio-title" @class="kg-upload-title"
/> />
<div class="kg-player"> <div class="kg-player">
<button class="kg-audio-play-icon">{{svg-jar "play"}}</button> <button class="kg-audio-play-icon">{{svg-jar "play"}}</button>
@ -130,7 +130,7 @@
</div> </div>
</div> </div>
{{else}} {{else}}
<div class="kg-audio-container kg-audio-container-empty"> <div class="kg-upload-container kg-upload-container-empty">
<GhUploader <GhUploader
@uploadUrl="/media/upload/" @uploadUrl="/media/upload/"
@resourceName="media" @resourceName="media"
@ -166,7 +166,7 @@
{{else}} {{else}}
<div {{on "click" this.triggerAudioFileDialog}} class="flex pa4"> <div {{on "click" this.triggerAudioFileDialog}} class="flex pa4">
{{svg-jar "audio-upload"}} {{svg-jar "audio-upload"}}
<span class="kg-placeholder-text"> <span class="kg-upload-placeholder-text">
Click to upload an audio file Click to upload an audio file
</span> </span>
</div> </div>

View File

@ -1,6 +1,6 @@
<KoenigCard <KoenigCard
@env={{@env}} @env={{@env}}
@class={{"ba b--transparent relative kg-card-hover kg-card kg-audio-card mih10 miw-100 relative" (kg-style "breakout" size=@payload.cardWidth)}} @class={{"ba b--transparent relative kg-card-hover kg-card kg-file-card mih10 miw-100 relative" (kg-style "breakout" size=@payload.cardWidth)}}
@headerOffset={{@headerOffset}} @headerOffset={{@headerOffset}}
@toolbar={{this.toolbar}} @toolbar={{this.toolbar}}
@payload={{@payload}} @payload={{@payload}}
@ -23,34 +23,36 @@
as |card| as |card|
> >
{{#if @payload.src}} {{#if @payload.src}}
<div class="kg-audio-container"> <div class="kg-upload-container">
<div class="kg-media-container"> <div class="kg-media-container light">
<button class="kg-audio-button"> <button class="kg-upload-button">
{{svg-jar "audio-file" class="kg-audio-icon"}} {{svg-jar "file-download" class="kg-audio-icon"}}
</button> </button>
</div> </div>
<div class="kg-file-data-container"> <div class="kg-file-data-container">
<GhTextInput <div>
@value={{@payload.fileTitle}} <GhTextInput
@placeholder="File Title" @value={{@payload.fileTitle}}
@input={{action "setFileTitle" value="target.value"}} @placeholder="File Title"
@class="kg-audio-title" @input={{action "setFileTitle" value="target.value"}}
/> @class="kg-upload-title"
<GhTextInput />
@value={{@payload.fileCaption}} <GhTextInput
@input={{action "setFileCaption" value="target.value"}} @value={{@payload.fileCaption}}
@placeholder="File Caption" @input={{action "setFileCaption" value="target.value"}}
@class="kg-audio-title kg-file-card-caption" @placeholder="File Caption"
/> @class="kg-upload-caption"
<div style="display:flex;line-height:1.15;margin-top:10px;margin-left:10px;font-size:1.3rem"> />
<div style="margin-right: 12px;font-weight:bold"> {{this.fileName}} </div> </div>
<div> {{this.fileSize}} </div> <div class="kg-upload-metadata">
{{!-- </div>style="display:flex;line-height:1.15;margin-top:10px;margin-left:10px;font-size:1.3rem"> --}}
{{this.fileName}} <span class="kg-upload-filesize">&bull; {{this.fileSize}}</span>
</div> </div>
</div> </div>
</div> </div>
{{else}} {{else}}
<div class="kg-audio-container kg-audio-container-empty" {{on "click" this.triggerFileDialog}}> <div class="kg-upload-container kg-upload-container-empty">
<GhUploader <GhUploader
@uploadUrl="/files/upload/" @uploadUrl="/files/upload/"
@resourceName="files" @resourceName="files"
@ -82,10 +84,12 @@
{{else if uploader.isUploading}} {{else if uploader.isUploading}}
{{uploader.progressBar}} {{uploader.progressBar}}
{{else}} {{else}}
{{svg-jar "audio-upload"}} <div {{on "click" this.triggerFileDialog}} class="flex pa4 midgrey">
<span class="kg-placeholder-text"> {{svg-jar "file-upload"}}
<span class="kg-upload-placeholder-text">
Click to upload a file Click to upload a file
</span> </span>
</div>
{{/if}} {{/if}}
{{/if}} {{/if}}

View File

@ -65,7 +65,7 @@
{{else if (not this.previewThumbnailSrc @payload.src)}} {{else if (not this.previewThumbnailSrc @payload.src)}}
<button class="flex flex-column items-center center sans-serif fw4 f7 middarkgrey pa16 pt14 pb14 kg-image-button" {{on "click" this.triggerVideoFileDialog}}> <button class="flex flex-column items-center center sans-serif fw4 f7 middarkgrey pa16 pt14 pb14 kg-image-button" {{on "click" this.triggerVideoFileDialog}}>
{{svg-jar "film-camera" class="kg-placeholder-video"}} {{svg-jar "film-camera" class="kg-placeholder-video"}}
<span class="mt4 kg-placeholder-text">Click to select a video</span> <span class="mt4 kg-upload-placeholder-text">Click to select a video</span>
</button> </button>
{{/if}} {{/if}}
</div> </div>

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><defs><style>.a{fill:none;stroke:currentColor;stroke-linecap:round;stroke-linejoin:round;stroke-width:1.5px;}</style></defs><title>common-file-download</title><circle class="a" cx="17.25" cy="17.25" r="6"/><line class="a" x1="17.25" y1="14.25" x2="17.25" y2="20.25"/><line class="a" x1="17.25" y1="20.25" x2="19.5" y2="18"/><line class="a" x1="17.25" y1="20.25" x2="15" y2="18"/><path class="a" d="M8.25,20.25h-6a1.5,1.5,0,0,1-1.5-1.5V2.25A1.5,1.5,0,0,1,2.25.75H12.879a1.5,1.5,0,0,1,1.06.439l2.872,2.872a1.5,1.5,0,0,1,.439,1.06V8.25"/></svg>

After

Width:  |  Height:  |  Size: 601 B

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><defs><style>.a{fill:none;stroke:currentColor;stroke-linecap:round;stroke-linejoin:round;stroke-width:1.5px;}</style></defs><title>common-file-upload</title><circle class="a" cx="17.25" cy="17.25" r="6"/><line class="a" x1="17.25" y1="20.25" x2="17.25" y2="14.25"/><line class="a" x1="17.25" y1="14.25" x2="15" y2="16.5"/><line class="a" x1="17.25" y1="14.25" x2="19.5" y2="16.5"/><path class="a" d="M8.25,20.25h-6a1.5,1.5,0,0,1-1.5-1.5V2.25A1.5,1.5,0,0,1,2.25.75H12.879a1.5,1.5,0,0,1,1.06.439l2.872,2.872a1.5,1.5,0,0,1,.439,1.06V8.25"/></svg>

After

Width:  |  Height:  |  Size: 603 B