Ghost/ghost/admin/app/styles/components/unsplash.css
Kevin Ansfield 350e3d1481 Unsplash integration
closes https://github.com/TryGhost/Ghost/issues/8859, requires https://github.com/TryGhost/Ghost/pull/8895
- adds Unsplash app to app settings
  - enable/disable toggle
  - validation and testing of Unsplash App ID
  - Unsplash App ID field hidden if provided via Ghost config
  - adds `fetchPrivate` method to `config` service to pull config that requires authentication and updates authentication routines to fetch private config
- adds Unsplash buttons to editor toolbar and `{{gh-image-uploader}}`
  - only present when Unsplash app is enabled
  - opens Unsplash image selector when clicked
  - `{{gh-image-uploader}}` has a new `allowUnsplash` attribute to control display of the unsplash button on a per-uploader basis
- adds Unsplash image selector (`{{gh-unsplash}}`)
  - uses new `unsplash` service to handle API requests and maintain state
  - search
  - infinite scroll
  - zoom image
  - insert image
  - download image
- adds `{{gh-scroll-trigger}}` that will fire an event when the component is rendered into or enters the visible screen area via scrolling
- updates `ui` service
  - adds `isFullscreen` property and updates `gh-editor` so that it gets set/unset when toggling editor fullscreen mode
  - adds `hasSideNav` and `isSideNavHidden` properties
- updates `media-queries` service so that it fires an event each time a breakpoint is entered/exited
  - removes the need for observers in certain circumstances
2017-08-15 16:01:12 +01:00

325 lines
5.8 KiB
CSS

/* Unsplash Integration
/* ---------------------------------------------------------- */
/* The parent container + layout
/* ---------------------------------------------------------- */
.gh-unsplash {
position: fixed;
top: 0;
right: 0;
bottom: 0;
left: 0;
z-index: 9000;
overflow: auto;
}
.gh-unsplash--with-sidenav {
margin-left: 280px;
}
.gh-unsplash-window {
padding: 25px;
background: #fff;
}
.gh-unsplash-container {
display: flex;
flex-direction: column;
width: 100%;
min-height: calc(100vh - 200px);
max-width: 1200px;
margin: 100px auto;
}
.gh-unsplash-logo {
position: absolute;
top: 23px;
left: 25px;
display: block;
}
.gh-unsplash-logo svg {
width: 32px;
}
.gh-unsplash-close {
position: absolute;
top: 25px;
right: 25px;
width: 25px;
height: 25px;
}
.gh-unsplash-close:hover {
cursor: pointer;
}
.gh-unsplash-close svg {
fill: color(var(--midgrey) l(+15%));
}
.gh-unsplash-header {
text-align: center;
}
.gh-unsplash-header-desc {
font-size: 1.6rem;
line-height: 1.6em;
}
.gh-unsplash-header .gh-input-icon svg {
left: 15px;
fill: #777;
}
.gh-unsplash-header .gh-input-icon {
display: block;
max-width: 1000px;
margin: 50px auto;
}
.gh-unsplash-search {
width: 100%;
height: 40px;
margin: 0;
padding: 0 30px 1px 50px;
outline: none;
border: 1px solid transparent;
color: #111;
font-size: 14px;
background-color: #f1f1f1;
border-radius: 20px;
transition: all 0.2s ease-in-out;
appearance: none;
}
.gh-unsplash-search:hover {
border-color: #d1d1d1;
}
.gh-unsplash-search:focus {
border-color: #d1d1d1;
background: #fff;
}
/* Loading styles
/* ---------------------------------------------------------- */
.gh-unsplash-loading {
flex-grow: 1;
display: flex;
justify-content: center;
align-items: center;
}
/* Error styles
/* ---------------------------------------------------------- */
.gh-unsplash-error {
max-width: 1200px;
text-align: center;
}
.gh-unsplash-error-404 {
display: block;
min-height: 225px;
max-width: 300px;
margin: 0 auto;
}
/* Photo grid and global styles
/* ---------------------------------------------------------- */
.gh-unsplash .gh-loading-spinner {
display: block;
margin: 0 auto;
}
.gh-unsplash-grid {
display: flex;
flex-direction: row;
justify-content: center;
align-content: stretch;
box-sizing: border-box;
width: 100%;
}
.gh-unsplash-grid-column {
flex-grow: 1;
flex-basis: 0;
display: flex;
flex-direction: column;
justify-content: flex-start;
align-content: stretch;
margin-right: 24px;
}
.gh-unsplash-grid-column:last-of-type {
margin-right: 0;
}
.gh-unsplash-photo {
position: relative;
display: block;
width: 100%;
margin: 0 0 24px;
color: #fff;
cursor: zoom-in;
}
.gh-unsplash-photo-container > img {
position: absolute;
display: block;
height: auto;
}
/* Hover overlay */
.gh-unsplash-photo-overlay {
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
display: flex;
flex-direction: column;
justify-content: space-between;
padding: 20px;
color: #fff;
background-image: linear-gradient(180deg,rgba(0,0,0,0.2) 0,transparent 40%,transparent 60%,rgba(0,0,0,0.3));
opacity: 0;
transition: all 0.15s ease-in-out;
}
.gh-unsplash-photo:hover .gh-unsplash-photo-overlay {
opacity: 1;
}
/* Buttons used within photo cards */
.gh-unsplash-button {
flex-shrink: 0;
display: flex;
align-items: center;
margin-left: 10px;
padding: 8px 12px;
color: #777;
font-size: 1.4rem;
line-height: 1.1em;
font-weight: 500;
background: #fff;
border-radius: 5px;
opacity: 0.9;
transition: all 0.15s ease-in-out;
}
.gh-unsplash-button:hover {
opacity: 1;
}
/* Photo overlay content
/* ---------------------------------------------------------- */
.gh-unsplash-photo-header {
flex-grow: 0;
display: flex;
justify-content: flex-end;
align-items: center;
}
.gh-unsplash-photo-author {
display: flex;
align-items: center;
min-width: 0;
font-size: 1.5rem;
line-height: 1.15em;
}
.gh-unsplash-photo-author-img {
flex-shrink: 0;
display: block;
width: 30px;
height: 30px;
overflow: hidden;
margin-right: 10px;
border-radius: 100%;
}
.gh-unsplash-photo-author-name {
display: block;
overflow: hidden;
color: #fff;
text-decoration: none;
text-overflow: ellipsis;
white-space: nowrap;
}
.gh-unsplash-button-likes svg {
height: 15px;
margin-right: 5px;
fill: #ff3f49;
}
.gh-unsplash-photo-footer {
display: flex;
justify-content: space-between;
align-items: center;
}
.gh-unsplash-button-download svg {
height: 13px;
margin: 2px 0 0 0;
stroke: #777;
stroke-width: 3px;
}
/* Photo Zoom Preview
/* ---------------------------------------------------------- */
.gh-unsplash-zoom {
position: fixed;
top: 0;
right: 0;
bottom: 0;
left: 0;
z-index: 9500;
display: flex;
justify-content: center;
align-items: center;
overflow: auto;
padding: 25px;
background: rgba(255,255,255,0.8);
backdrop-filter: blur(2px);
}
.gh-unsplash-zoom .gh-unsplash-photo {
position: relative;
width: auto;
min-height: 400px;
max-width: 1200px;
max-height: calc(100vh - 50px);
margin: 0;
color: #fff;
cursor: zoom-out;
background: var(--darkgrey);
box-shadow: rgba(39,44,49,0.1) 8px 14px 38px, rgba(39, 44, 49, 0.08) 1px 3px 8px;
}
.gh-unsplash-zoom .gh-unsplash-photo-container > img {
position: static;
display: block;
width: auto;
max-height: calc(100vh - 50px);
}
.gh-unsplash-zoom .gh-unsplash-photo-overlay {
opacity: 1;
}