diff --git a/custom/README.md b/custom/README.md index b51e3c92..c54c2567 100644 --- a/custom/README.md +++ b/custom/README.md @@ -89,6 +89,10 @@ The site name, logo, and most of the text on the website can be modified from th placing a value for the same key in `custom/strings.yaml`, with a custom string, Javascript function, or image path. +## Image Modal +Images can opened/expanded in a modal/dialog. On hover of an image, the cursor will turn into the pointer style, and an expand button will show. Once clicked, the image will center in the page, and a minimize icon will show. Styles for the modal can be found in +`/styles/partials/core/_furniture.scss` as well as one line in `/styles/partials/core/_base.scss` that adds a pointer cursor on hover of images. All HTML/JS for the Image Modal is included in the [`/layouts/partials/imgModal.ejs`](../layouts/partials/imgModal.ejs) file. The Image Modal is then imported in the default layout for content, code for which can be found [here](../layouts/categories/default.ejs#L29). + ## Middleware Middleware can be added to the beginning or end of the request cycle by placing files into `custom/middleware`. These files can export `preload` and `postload` diff --git a/layouts/categories/default.ejs b/layouts/categories/default.ejs index c0a35393..28a0021e 100644 --- a/layouts/categories/default.ejs +++ b/layouts/categories/default.ejs @@ -26,7 +26,7 @@ <%- include('partials/childrenList', {children, kicker: template('folder.childrenList.kicker', title)}) %> <% } %> - + <%- include('partials/imgModal') %> <%- include('partials/footer', { pageType: 'document', topLevelFolder: url.split('/')[1] }) %> diff --git a/layouts/partials/imgModal.ejs b/layouts/partials/imgModal.ejs new file mode 100644 index 00000000..21291e78 --- /dev/null +++ b/layouts/partials/imgModal.ejs @@ -0,0 +1,84 @@ +
+ +
+ +
+ + +
+ + diff --git a/styles/partials/core/_categories.scss b/styles/partials/core/_categories.scss index 4c0fccd0..7c0927e7 100644 --- a/styles/partials/core/_categories.scss +++ b/styles/partials/core/_categories.scss @@ -271,6 +271,7 @@ padding: 10px; display: block; margin: 20px auto; + cursor: pointer; // images can be opened in a modal @include tablet{ max-width: 580px; diff --git a/styles/partials/core/_furniture.scss b/styles/partials/core/_furniture.scss index c657235d..047507a6 100644 --- a/styles/partials/core/_furniture.scss +++ b/styles/partials/core/_furniture.scss @@ -451,3 +451,76 @@ text-align: center; } } + +// the image-wrapper class is added for the benefit of the +// Image Modal, so co-locating it here +.image-wrapper { + position: relative; + + .expand-image-btn { + height: 60px; + width: 60px; + position: absolute; + bottom: 25px; + right: 25px; + opacity: 0; + transition: opacity 0.3s ease 0s; + background-color: transparent; + pointer-events: none; + border: none; + } + + &:hover { + .expand-image-btn { + opacity: 1; + } + } +} + +.image-modal { + display: none; + position: fixed; + z-index: 1000000090; /* search bar icon has z-index of 1*10 */ + inset: 0px; /* shorthand for top,right,bottom,left at the same time */ + overflow: hidden; + background-color: rgb(255, 255, 255); /* full white allows images to pop */ + transition: display 0.2s ease 0s; +} + +.image-modal .img-wrapper { + display: flex; + align-items: center; + align-content: center; + height: 100%; + padding: 30px; + + .modal-image { + margin: auto; + display: block; + max-width: 100%; + cursor: default; + } +} + +.image-modal .close { + display: flex; + align-items: center; + position: absolute; + top: 10px; + right: 10px; + background-color: transparent; + cursor: pointer; + border: 0.5px solid white; + border-radius: 50%; + width: 60px; + height: 60px; + transition: all 0.1s ease-in; + padding: 0px; + + &:hover, &:focus { + background-color: #f9f9f9; + border-color: lightgray; + } +} + +