playbook_ui 10.18.2 → 10.19.0.pre.lightbox
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/pb_kits/playbook/_playbook.scss +2 -0
- data/app/pb_kits/playbook/data/menu.yml +1 -0
- data/app/pb_kits/playbook/index.js +2 -1
- data/app/pb_kits/playbook/pb_body/_body.jsx +1 -1
- data/app/pb_kits/playbook/pb_body/_body_mixins.scss +2 -1
- data/app/pb_kits/playbook/pb_body/body.rb +1 -1
- data/app/pb_kits/playbook/pb_body/body.test.js +29 -0
- data/app/pb_kits/playbook/pb_body/docs/_body_light.html.erb +5 -0
- data/app/pb_kits/playbook/pb_body/docs/_body_light.jsx +5 -0
- data/app/pb_kits/playbook/pb_body/docs/_body_light.md +6 -0
- data/app/pb_kits/playbook/pb_caption/_caption.jsx +6 -6
- data/app/pb_kits/playbook/pb_caption/_caption.scss +6 -17
- data/app/pb_kits/playbook/pb_caption/_caption_mixin.scss +13 -3
- data/app/pb_kits/playbook/pb_caption/caption.rb +3 -5
- data/app/pb_kits/playbook/pb_caption/caption.test.js +29 -0
- data/app/pb_kits/playbook/pb_caption/docs/_caption_colors.html.erb +3 -0
- data/app/pb_kits/playbook/pb_caption/docs/_caption_colors.jsx +25 -0
- data/app/pb_kits/playbook/pb_caption/docs/_caption_colors.md +6 -0
- data/app/pb_kits/playbook/pb_caption/docs/example.yml +2 -2
- data/app/pb_kits/playbook/pb_caption/docs/index.js +1 -2
- data/app/pb_kits/playbook/pb_lightbox/Carousel/Slide.jsx +53 -0
- data/app/pb_kits/playbook/pb_lightbox/Carousel/Slides.jsx +54 -0
- data/app/pb_kits/playbook/pb_lightbox/Carousel/Thumbnail.jsx +39 -0
- data/app/pb_kits/playbook/pb_lightbox/Carousel/Thumbnails.jsx +82 -0
- data/app/pb_kits/playbook/pb_lightbox/Carousel/index.jsx +54 -0
- data/app/pb_kits/playbook/pb_lightbox/Carousel/styles.scss +110 -0
- data/app/pb_kits/playbook/pb_lightbox/Carousel/useSlides.js +66 -0
- data/app/pb_kits/playbook/pb_lightbox/Carousel/useUnscrollableBody.js +11 -0
- data/app/pb_kits/playbook/pb_lightbox/_lightbox.jsx +81 -0
- data/app/pb_kits/playbook/pb_lightbox/docs/_lightbox_default.jsx +65 -0
- data/app/pb_kits/playbook/pb_lightbox/docs/_lightbox_default.md +1 -0
- data/app/pb_kits/playbook/pb_lightbox/docs/_lightbox_multiple.jsx +65 -0
- data/app/pb_kits/playbook/pb_lightbox/docs/example.yml +6 -0
- data/app/pb_kits/playbook/pb_lightbox/docs/index.js +2 -0
- data/app/pb_kits/playbook/pb_lightbox/hooks/useToggler.js +10 -0
- data/app/pb_kits/playbook/pb_lightbox/hooks/useVisibility.js +21 -0
- data/app/pb_kits/playbook/pb_lightbox/hooks/useWindowSize.js +25 -0
- data/app/pb_kits/playbook/pb_lightbox/lightbox.scss +92 -0
- data/app/pb_kits/playbook/pb_lightbox/lightbox.test.jsx +30 -0
- data/app/pb_kits/playbook/pb_nav/_bold_mixin.scss +22 -0
- data/app/pb_kits/playbook/pb_nav/_horizontal_nav.scss +17 -1
- data/app/pb_kits/playbook/pb_nav/_vertical_nav.scss +9 -2
- data/app/pb_kits/playbook/pb_nav/docs/_bold_horizontal_nav.html.erb +6 -0
- data/app/pb_kits/playbook/pb_nav/docs/_bold_horizontal_nav.jsx +39 -0
- data/app/pb_kits/playbook/pb_nav/docs/_bold_vertical_nav.html.erb +6 -0
- data/app/pb_kits/playbook/pb_nav/docs/_bold_vertical_nav.jsx +39 -0
- data/app/pb_kits/playbook/pb_nav/docs/_horizontal_nav.html.erb +1 -1
- data/app/pb_kits/playbook/pb_nav/docs/_subtle_nav.html.erb +1 -1
- data/app/pb_kits/playbook/pb_nav/docs/example.yml +4 -0
- data/app/pb_kits/playbook/pb_nav/docs/index.js +2 -0
- data/app/pb_kits/playbook/pb_nav/nav.rb +1 -1
- data/app/pb_kits/playbook/pb_popover/docs/_popover_scroll_height.jsx +3 -0
- data/app/pb_kits/playbook/pb_popover/docs/_popover_z_index.jsx +1 -0
- data/app/pb_kits/playbook/pb_text_input/_text_input.scss +62 -13
- data/app/pb_kits/playbook/pb_text_input/docs/_text_input_error.html.erb +21 -2
- data/app/pb_kits/playbook/pb_text_input/docs/_text_input_error.jsx +12 -3
- data/app/pb_kits/playbook/pb_title/_title.jsx +6 -4
- data/app/pb_kits/playbook/pb_title/_title.scss +5 -5
- data/app/pb_kits/playbook/pb_title/_title_mixin.scss +17 -0
- data/app/pb_kits/playbook/pb_title/docs/_title_colors.html.erb +4 -0
- data/app/pb_kits/playbook/pb_title/docs/_title_colors.jsx +37 -0
- data/app/pb_kits/playbook/pb_title/docs/_title_colors.md +6 -0
- data/app/pb_kits/playbook/pb_title/docs/_title_light.md +3 -0
- data/app/pb_kits/playbook/pb_title/docs/example.yml +2 -2
- data/app/pb_kits/playbook/pb_title/docs/index.js +1 -1
- data/app/pb_kits/playbook/pb_title/title.html.erb +2 -3
- data/app/pb_kits/playbook/pb_title/title.rb +5 -4
- data/app/pb_kits/playbook/pb_title/title.test.js +29 -0
- data/app/pb_kits/playbook/playbook-doc.js +2 -0
- data/app/pb_kits/playbook/utilities/_line_height.scss +11 -0
- data/app/pb_kits/playbook/utilities/globalProps.js +7 -1
- data/lib/playbook/classnames.rb +1 -0
- data/lib/playbook/kit_base.rb +2 -0
- data/lib/playbook/line_height.rb +29 -0
- data/lib/playbook/version.rb +1 -1
- metadata +41 -13
- data/app/pb_kits/playbook/pb_caption/docs/_caption_example.html.erb +0 -3
- data/app/pb_kits/playbook/pb_caption/docs/_caption_example.jsx +0 -27
- data/app/pb_kits/playbook/pb_caption/docs/_caption_example.md +0 -1
- data/app/pb_kits/playbook/pb_caption/docs/_caption_variants.html.erb +0 -1
- data/app/pb_kits/playbook/pb_caption/docs/_caption_variants.jsx +0 -17
- data/app/pb_kits/playbook/pb_caption/docs/_caption_variants.md +0 -3
- data/app/pb_kits/playbook/pb_title/docs/_title_variants.html.erb +0 -1
- data/app/pb_kits/playbook/pb_title/docs/_title_variants.jsx +0 -19
- data/app/pb_kits/playbook/pb_title/docs/_title_variants.md +0 -3
@@ -0,0 +1,110 @@
|
|
1
|
+
.Lightbox {
|
2
|
+
width: 100vw;
|
3
|
+
height: 100vh;
|
4
|
+
position: fixed;
|
5
|
+
left: 0;
|
6
|
+
top: 0;
|
7
|
+
display: flex;
|
8
|
+
align-items: center;
|
9
|
+
flex-direction: column;
|
10
|
+
background-color: black;
|
11
|
+
z-index: 1;
|
12
|
+
overflow: hidden;
|
13
|
+
}
|
14
|
+
|
15
|
+
.Slides {
|
16
|
+
display: flex;
|
17
|
+
flex-grow: 1;
|
18
|
+
height: calc(100% - 100px);
|
19
|
+
width: 100%;
|
20
|
+
z-index: 1;
|
21
|
+
|
22
|
+
[class^="react-transform-wrapper"] {
|
23
|
+
flex-shrink: 0;
|
24
|
+
width: 100%;
|
25
|
+
height: 100%;
|
26
|
+
}
|
27
|
+
|
28
|
+
[class^="react-transform-content"] {
|
29
|
+
width: 100%;
|
30
|
+
height: 100%;
|
31
|
+
}
|
32
|
+
}
|
33
|
+
|
34
|
+
.Slide,
|
35
|
+
.Thumbnail {
|
36
|
+
flex-shrink: 0;
|
37
|
+
border: none;
|
38
|
+
margin: 0;
|
39
|
+
padding: 0;
|
40
|
+
cursor: pointer;
|
41
|
+
background-color: transparent;
|
42
|
+
}
|
43
|
+
|
44
|
+
.Slide {
|
45
|
+
display: flex;
|
46
|
+
justify-content: center;
|
47
|
+
align-items: center;
|
48
|
+
width: 100%;
|
49
|
+
height: 100%;
|
50
|
+
overflow: hidden;
|
51
|
+
|
52
|
+
img {
|
53
|
+
width: 100vw;
|
54
|
+
height: 100vh;
|
55
|
+
object-fit: contain;
|
56
|
+
}
|
57
|
+
}
|
58
|
+
|
59
|
+
.BackBtn,
|
60
|
+
.NextBtn {
|
61
|
+
z-index: 2;
|
62
|
+
color: black;
|
63
|
+
position: absolute;
|
64
|
+
width: 50px;
|
65
|
+
height: 50px;
|
66
|
+
top: calc(50vh - 5px);
|
67
|
+
border: none;
|
68
|
+
border-radius: 50%;
|
69
|
+
background-color: white;
|
70
|
+
}
|
71
|
+
|
72
|
+
.BackBtn::before,
|
73
|
+
.NextBtn::before {
|
74
|
+
content: "▸";
|
75
|
+
}
|
76
|
+
|
77
|
+
.BackBtn {
|
78
|
+
left: 30px;
|
79
|
+
transform: rotate(180deg);
|
80
|
+
}
|
81
|
+
|
82
|
+
.NextBtn {
|
83
|
+
right: 30px;
|
84
|
+
}
|
85
|
+
|
86
|
+
.Thumbnails {
|
87
|
+
display: flex;
|
88
|
+
padding: 3px;
|
89
|
+
}
|
90
|
+
|
91
|
+
.Thumbnails.draggable {
|
92
|
+
align-self: flex-start;
|
93
|
+
}
|
94
|
+
|
95
|
+
.Thumbnail {
|
96
|
+
padding: 3px;
|
97
|
+
height: 100%;
|
98
|
+
|
99
|
+
img {
|
100
|
+
width: 100%;
|
101
|
+
height: 100%;
|
102
|
+
}
|
103
|
+
}
|
104
|
+
|
105
|
+
.Thumbnail.active {
|
106
|
+
padding: 6px;
|
107
|
+
background-color: white;
|
108
|
+
box-shadow: 0 0 6px white;
|
109
|
+
}
|
110
|
+
|
@@ -0,0 +1,66 @@
|
|
1
|
+
// @flow
|
2
|
+
|
3
|
+
import { noop } from 'lodash'
|
4
|
+
import { useEffect, useState } from 'react'
|
5
|
+
import { useAnimation } from 'framer-motion/dist/framer-motion'
|
6
|
+
import { useWindowSize } from '../hooks/useWindowSize'
|
7
|
+
|
8
|
+
const cycleIndex = (current: number, min: number, max: number): number => {
|
9
|
+
if (current < min) return max
|
10
|
+
if (current > max) return min
|
11
|
+
return current
|
12
|
+
}
|
13
|
+
|
14
|
+
const swipeConfidenceThreshold = 10000
|
15
|
+
const swipePower = (offset: number, velocity: number) => {
|
16
|
+
return Math.abs(offset) * velocity
|
17
|
+
}
|
18
|
+
|
19
|
+
export default function useSlides({
|
20
|
+
current = 0,
|
21
|
+
pagesCount = 0,
|
22
|
+
onChange = noop,
|
23
|
+
}) {
|
24
|
+
const controls = useAnimation()
|
25
|
+
const viewportSize = useWindowSize()
|
26
|
+
const [currentIndex, setCurrentIndex] = useState(current)
|
27
|
+
const dragConstraints = {
|
28
|
+
left: -viewportSize.width * (pagesCount - 1),
|
29
|
+
right: 0,
|
30
|
+
}
|
31
|
+
|
32
|
+
const paginate = (newDirection: number) => {
|
33
|
+
const nextIndex = currentIndex + newDirection
|
34
|
+
const cycledNextIndex = cycleIndex(nextIndex, 0, pagesCount - 1)
|
35
|
+
setCurrentIndex(cycledNextIndex)
|
36
|
+
return cycledNextIndex
|
37
|
+
}
|
38
|
+
|
39
|
+
const handleDragEnd = (e, { offset, velocity }) => {
|
40
|
+
let nextIndex = currentIndex
|
41
|
+
const swipe = swipePower(offset.x, velocity.x)
|
42
|
+
|
43
|
+
if (swipe < -swipeConfidenceThreshold) {
|
44
|
+
nextIndex = paginate(1)
|
45
|
+
} else if (swipe > swipeConfidenceThreshold) {
|
46
|
+
nextIndex = paginate(-1)
|
47
|
+
}
|
48
|
+
|
49
|
+
controls.start({ x: -viewportSize.width * nextIndex })
|
50
|
+
|
51
|
+
if (nextIndex !== currentIndex) {
|
52
|
+
onChange(nextIndex)
|
53
|
+
}
|
54
|
+
}
|
55
|
+
|
56
|
+
useEffect(() => {
|
57
|
+
controls.set({ x: -viewportSize.width * current })
|
58
|
+
setCurrentIndex(current)
|
59
|
+
}, [controls, current, viewportSize.width])
|
60
|
+
|
61
|
+
return {
|
62
|
+
controls,
|
63
|
+
dragConstraints,
|
64
|
+
handleDragEnd,
|
65
|
+
}
|
66
|
+
}
|
@@ -0,0 +1,81 @@
|
|
1
|
+
/* eslint-disable no-unused-vars */
|
2
|
+
/* @flow */
|
3
|
+
|
4
|
+
import React, { useState } from 'react'
|
5
|
+
import classnames from 'classnames'
|
6
|
+
import { buildAriaProps, buildCss, buildDataProps } from '../utilities/props.js'
|
7
|
+
import { globalProps } from '../utilities/globalProps.js'
|
8
|
+
import Icon from '../pb_icon/_icon'
|
9
|
+
|
10
|
+
import Carousel from './Carousel/index.jsx'
|
11
|
+
|
12
|
+
type LightboxType = {
|
13
|
+
aria?: object,
|
14
|
+
className?: string,
|
15
|
+
data?: object,
|
16
|
+
id?: string,
|
17
|
+
photos: [],
|
18
|
+
initialPhoto: string,
|
19
|
+
onClose: Function,
|
20
|
+
icon: string,
|
21
|
+
iconSize: number,
|
22
|
+
}
|
23
|
+
|
24
|
+
const Lightbox = (props: LightboxType) => {
|
25
|
+
const {
|
26
|
+
aria = {},
|
27
|
+
className,
|
28
|
+
data = {},
|
29
|
+
id = '',
|
30
|
+
photos,
|
31
|
+
initialPhoto,
|
32
|
+
onClose,
|
33
|
+
icon,
|
34
|
+
iconSize,
|
35
|
+
} = props
|
36
|
+
const [activePhoto, setActivePhoto] = useState(initialPhoto)
|
37
|
+
|
38
|
+
const ariaProps = buildAriaProps(aria)
|
39
|
+
const dataProps = buildDataProps(data)
|
40
|
+
const classes = classnames(
|
41
|
+
buildCss('pb_lightbox_kit'),
|
42
|
+
globalProps(props),
|
43
|
+
className
|
44
|
+
)
|
45
|
+
const handleOnSlide = (index) => {
|
46
|
+
setActivePhoto(photos[index])
|
47
|
+
}
|
48
|
+
return (
|
49
|
+
<div
|
50
|
+
{...ariaProps}
|
51
|
+
{...dataProps}
|
52
|
+
className={classes}
|
53
|
+
id={id}
|
54
|
+
>
|
55
|
+
<div className="carousel">
|
56
|
+
<div className="carousel-header">
|
57
|
+
<div
|
58
|
+
className="close-icon"
|
59
|
+
onClick={onClose}
|
60
|
+
>
|
61
|
+
<Icon
|
62
|
+
icon={icon}
|
63
|
+
size={iconSize}
|
64
|
+
/>
|
65
|
+
</div>
|
66
|
+
<div className="active-photo-overlay" />
|
67
|
+
</div>
|
68
|
+
<Carousel
|
69
|
+
current={photos.indexOf(initialPhoto)}
|
70
|
+
onChange={handleOnSlide}
|
71
|
+
photos={photos.map((photo) => ({
|
72
|
+
url: photo,
|
73
|
+
thumbnail: photo,
|
74
|
+
}))}
|
75
|
+
/>
|
76
|
+
</div>
|
77
|
+
</div>
|
78
|
+
)
|
79
|
+
}
|
80
|
+
|
81
|
+
export default Lightbox
|
@@ -0,0 +1,65 @@
|
|
1
|
+
/* @flow */
|
2
|
+
/* eslint-disable jsx-control-statements/jsx-use-if-tag */
|
3
|
+
import React, { useState } from 'react'
|
4
|
+
import { useToggler } from '../hooks/useToggler.js'
|
5
|
+
import { Flex, Image } from '../../'
|
6
|
+
import Lightbox from '../_lightbox'
|
7
|
+
|
8
|
+
const LightboxDefault = (props) => {
|
9
|
+
const photos = [
|
10
|
+
'https://images.unsplash.com/photo-1638727228877-d2a79ab75e68?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=2668&q=80',
|
11
|
+
]
|
12
|
+
const [selectedPhoto, setSelectedPhoto] = useState(photos[0])
|
13
|
+
const [showLightbox, toggleShowLightbox] = useToggler()
|
14
|
+
|
15
|
+
const handleCloseLightbox = () => {
|
16
|
+
toggleShowLightbox()
|
17
|
+
setSelectedPhoto(null)
|
18
|
+
}
|
19
|
+
|
20
|
+
const onPhotoClick = (photo) => {
|
21
|
+
toggleShowLightbox()
|
22
|
+
setSelectedPhoto(photo)
|
23
|
+
}
|
24
|
+
|
25
|
+
return (
|
26
|
+
<>
|
27
|
+
<div>
|
28
|
+
{showLightbox ? (
|
29
|
+
<Lightbox
|
30
|
+
icon="times"
|
31
|
+
iconSize="2x"
|
32
|
+
initialPhoto={selectedPhoto}
|
33
|
+
onClose={handleCloseLightbox}
|
34
|
+
photos={photos}
|
35
|
+
{...props}
|
36
|
+
/>
|
37
|
+
) : (
|
38
|
+
<div className="PhotoViewer">
|
39
|
+
<Flex>
|
40
|
+
{photos.map((photo, index) => {
|
41
|
+
return (
|
42
|
+
<div
|
43
|
+
key={photo[index]}
|
44
|
+
onClick={() => onPhotoClick(photo)}
|
45
|
+
>
|
46
|
+
<Image
|
47
|
+
marginRight="xl"
|
48
|
+
rounded
|
49
|
+
size="lg"
|
50
|
+
url={photo}
|
51
|
+
/>
|
52
|
+
|
53
|
+
<div className="overlay" />
|
54
|
+
</div>
|
55
|
+
)
|
56
|
+
})}
|
57
|
+
</Flex>
|
58
|
+
</div>
|
59
|
+
)}
|
60
|
+
</div>
|
61
|
+
</>
|
62
|
+
)
|
63
|
+
}
|
64
|
+
|
65
|
+
export default LightboxDefault
|
@@ -0,0 +1 @@
|
|
1
|
+
Lightbox contains 5 props: `photos` (an array of urls), `initialPhoto` (a number ), an `onClose` callback function, an `icon` prop that matches to our `Icon` kit, and an `iconSize` prop that also corresponds to our icon kit.
|
@@ -0,0 +1,65 @@
|
|
1
|
+
/* @flow */
|
2
|
+
/* eslint-disable jsx-control-statements/jsx-use-if-tag */
|
3
|
+
import React, { useState } from 'react'
|
4
|
+
import { useToggler } from '../hooks/useToggler.js'
|
5
|
+
import { Flex, Image } from '../../'
|
6
|
+
import Lightbox from '../_lightbox.jsx'
|
7
|
+
|
8
|
+
const LightboxMultiple = (props) => {
|
9
|
+
const photos = [
|
10
|
+
'https://images.unsplash.com/photo-1638727228877-d2a79ab75e68?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=2668&q=80',
|
11
|
+
'https://images.unsplash.com/photo-1526657782461-9fe13402a841?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1984&q=80',
|
12
|
+
'https://images.unsplash.com/photo-1523057530100-383d7fbc77a1?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=2669&q=80',
|
13
|
+
]
|
14
|
+
const [selectedPhoto, setSelectedPhoto] = useState(photos[0])
|
15
|
+
const [light, toggleLight] = useToggler()
|
16
|
+
|
17
|
+
const handleCloseLightbox = () => {
|
18
|
+
toggleLight()
|
19
|
+
setSelectedPhoto(null)
|
20
|
+
}
|
21
|
+
|
22
|
+
const onPhotoClick = (photo) => {
|
23
|
+
toggleLight()
|
24
|
+
setSelectedPhoto(photo)
|
25
|
+
}
|
26
|
+
|
27
|
+
return (
|
28
|
+
<div>
|
29
|
+
{light ? (
|
30
|
+
<Lightbox
|
31
|
+
icon="times"
|
32
|
+
iconSize="2x"
|
33
|
+
initialPhoto={selectedPhoto}
|
34
|
+
onClose={handleCloseLightbox}
|
35
|
+
photos={photos}
|
36
|
+
{...props}
|
37
|
+
/>
|
38
|
+
) : (
|
39
|
+
<div className="PhotoViewer">
|
40
|
+
<Flex>
|
41
|
+
{photos.map((photo, index) => {
|
42
|
+
return (
|
43
|
+
<div
|
44
|
+
key={photos[index]}
|
45
|
+
onClick={() => onPhotoClick(photo)}
|
46
|
+
>
|
47
|
+
<Image
|
48
|
+
marginRight="xl"
|
49
|
+
rounded
|
50
|
+
size="lg"
|
51
|
+
url={photo}
|
52
|
+
/>
|
53
|
+
|
54
|
+
<div className="overlay" />
|
55
|
+
</div>
|
56
|
+
)
|
57
|
+
})}
|
58
|
+
</Flex>
|
59
|
+
</div>
|
60
|
+
)}
|
61
|
+
</div>
|
62
|
+
)
|
63
|
+
}
|
64
|
+
|
65
|
+
export default LightboxMultiple
|
@@ -0,0 +1,21 @@
|
|
1
|
+
import { debounce } from 'lodash'
|
2
|
+
import { useCallback, useMemo, useState } from 'react'
|
3
|
+
|
4
|
+
export default function useVisibility(initialState = false) {
|
5
|
+
const [visible, setVisible] = useState(initialState)
|
6
|
+
const hide = useCallback(() => setVisible(false), [])
|
7
|
+
const show = useCallback(({ afterDelay = 0 } = {}) => {
|
8
|
+
debounce(() => setVisible(true), afterDelay)()
|
9
|
+
}, [])
|
10
|
+
const toggle = useCallback(() => setVisible((current) => !current), [])
|
11
|
+
|
12
|
+
return useMemo(
|
13
|
+
() => ({
|
14
|
+
hide,
|
15
|
+
show,
|
16
|
+
toggle,
|
17
|
+
visible,
|
18
|
+
}),
|
19
|
+
[hide, show, toggle, visible]
|
20
|
+
)
|
21
|
+
}
|
@@ -0,0 +1,25 @@
|
|
1
|
+
import { useEffect, useState } from 'react'
|
2
|
+
|
3
|
+
export const useWindowSize = () => {
|
4
|
+
const [size, setSize] = useState({
|
5
|
+
width: window.innerWidth,
|
6
|
+
height: window.innerHeight,
|
7
|
+
})
|
8
|
+
|
9
|
+
useEffect(() => {
|
10
|
+
const handleResize = () => {
|
11
|
+
setSize({
|
12
|
+
width: window.innerWidth,
|
13
|
+
height: window.innerHeight,
|
14
|
+
})
|
15
|
+
}
|
16
|
+
|
17
|
+
window.addEventListener('resize', handleResize)
|
18
|
+
|
19
|
+
handleResize()
|
20
|
+
|
21
|
+
return () => window.removeEventListener('resize', handleResize)
|
22
|
+
}, [])
|
23
|
+
|
24
|
+
return size
|
25
|
+
}
|
@@ -0,0 +1,92 @@
|
|
1
|
+
@import "../tokens/spacing";
|
2
|
+
|
3
|
+
.carousel {
|
4
|
+
.home-tour-main-content {
|
5
|
+
overflow-y: hidden;
|
6
|
+
}
|
7
|
+
|
8
|
+
.image-gallery-slide-wrapper {
|
9
|
+
width: 1024px;
|
10
|
+
height: 686px;
|
11
|
+
}
|
12
|
+
|
13
|
+
.image-gallery-slide div {
|
14
|
+
height: auto;
|
15
|
+
}
|
16
|
+
|
17
|
+
.image-gallery-slide .image-gallery-image {
|
18
|
+
max-height: 100% !important;
|
19
|
+
max-width: 100% !important;
|
20
|
+
height: 692px !important;
|
21
|
+
width: 100% !important;
|
22
|
+
object-fit: cover;
|
23
|
+
}
|
24
|
+
|
25
|
+
.image-gallery-left-nav .image-gallery-svg, .image-gallery-right-nav .image-gallery-svg {
|
26
|
+
height: 120px;
|
27
|
+
width: 30px;
|
28
|
+
opacity: 0.4;
|
29
|
+
}
|
30
|
+
.image-gallery-thumbnails {
|
31
|
+
overflow-x: auto;
|
32
|
+
}
|
33
|
+
|
34
|
+
.image-gallery-thumbnails-container {
|
35
|
+
width: 1024px;
|
36
|
+
padding-left: 4px;
|
37
|
+
}
|
38
|
+
|
39
|
+
.image-gallery-thumbnails {
|
40
|
+
padding-top: 3px;
|
41
|
+
background: #000;
|
42
|
+
}
|
43
|
+
|
44
|
+
.image-gallery-thumbnail-image {
|
45
|
+
height: 64px;
|
46
|
+
width: 93px;
|
47
|
+
}
|
48
|
+
|
49
|
+
.image-gallery-thumbnail + .image-gallery-thumbnail {
|
50
|
+
margin-left: 2px;
|
51
|
+
margin-top: 2px;
|
52
|
+
}
|
53
|
+
|
54
|
+
.carousel-header {
|
55
|
+
background: rgb(0, 0, 0);
|
56
|
+
border-radius: 0px;
|
57
|
+
min-height: 51px;
|
58
|
+
width: 100%;
|
59
|
+
position: fixed;
|
60
|
+
top: 0;
|
61
|
+
left: 0;
|
62
|
+
z-index: 2;
|
63
|
+
display: flex;
|
64
|
+
align-items: center;
|
65
|
+
padding: $space-sm;
|
66
|
+
transition: all .5s;
|
67
|
+
|
68
|
+
.close-icon {
|
69
|
+
color: white;
|
70
|
+
margin-left: 16px;
|
71
|
+
top: 16px;
|
72
|
+
position: absolute;
|
73
|
+
}
|
74
|
+
}
|
75
|
+
}
|
76
|
+
|
77
|
+
.photo-cards {
|
78
|
+
.overlay {
|
79
|
+
width: 100% !important;
|
80
|
+
height: 50% !important;
|
81
|
+
bottom: 0;
|
82
|
+
position: absolute !important;
|
83
|
+
border-radius: 0px 0px 5px 5px;
|
84
|
+
background: linear-gradient(-180deg, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.77) 100%);
|
85
|
+
}
|
86
|
+
|
87
|
+
.overlay,
|
88
|
+
.overlay ~ .key-photo-icon,
|
89
|
+
.overlay ~ .tag-counter {
|
90
|
+
pointer-events: none;
|
91
|
+
}
|
92
|
+
}
|
@@ -0,0 +1,30 @@
|
|
1
|
+
import React from 'react'
|
2
|
+
import { render, screen } from '../utilities/test-utils'
|
3
|
+
|
4
|
+
import { Lightbox } from '../'
|
5
|
+
|
6
|
+
const testId = 'customId',
|
7
|
+
kitClass = 'pb_lightbox_kit'
|
8
|
+
|
9
|
+
test('Lightbox Test', () => {
|
10
|
+
render(
|
11
|
+
<Lightbox
|
12
|
+
className="customClass"
|
13
|
+
data={{ testid: testId }}
|
14
|
+
icon="close"
|
15
|
+
iconSize="3x"
|
16
|
+
id="test1"
|
17
|
+
initialPhoto="https://images.unsplash.com/photo-1518791841217-8f162f1e1131?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=800&q=60"
|
18
|
+
onClose={() => {}}
|
19
|
+
photos={[
|
20
|
+
'https://images.unsplash.com/photo-1518791841217-8f162f1e1131?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=800&q=60',
|
21
|
+
'https://images.unsplash.com/photo-1518791841217-8f162f1e1131?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=800&q=60',
|
22
|
+
'https://images.unsplash.com/photo-1518791841217-8f162f1e1131?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=800&q=60',
|
23
|
+
'https://images.unsplash.com/photo-1518791841217-8f162f1e1131?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=800&q=60',
|
24
|
+
]}
|
25
|
+
/>
|
26
|
+
)
|
27
|
+
const kit = screen.getByTestId(testId)
|
28
|
+
expect(kit).toHaveClass(`${kitClass} customClass`)
|
29
|
+
expect(kit).toBeInTheDocument()
|
30
|
+
})
|
@@ -0,0 +1,22 @@
|
|
1
|
+
@mixin bold {
|
2
|
+
@include subtle;
|
3
|
+
|
4
|
+
[class*=pb_nav_list_kit_item] {
|
5
|
+
&[class*=_active] [class*=_link] {
|
6
|
+
background-color: $primary;
|
7
|
+
color: $white;
|
8
|
+
box-shadow: $shadow_deep;
|
9
|
+
@media (hover:hover) {
|
10
|
+
&:hover {
|
11
|
+
background-color: darken($primary, 4%);
|
12
|
+
[class*=_text],[class*=_icon] {
|
13
|
+
color: $white;
|
14
|
+
}
|
15
|
+
}
|
16
|
+
}
|
17
|
+
[class*=_text],[class*=_icon] {
|
18
|
+
font-weight: $bolder;
|
19
|
+
}
|
20
|
+
}
|
21
|
+
}
|
22
|
+
}
|
@@ -3,6 +3,8 @@
|
|
3
3
|
@import "../tokens/animation-curves";
|
4
4
|
@import "../tokens/typography";
|
5
5
|
@import "./subtle_mixin";
|
6
|
+
@import "./bold_mixin";
|
7
|
+
@import "../tokens/shadows";
|
6
8
|
|
7
9
|
$selector: ".pb_nav_list";
|
8
10
|
|
@@ -92,7 +94,21 @@ $selector: ".pb_nav_list";
|
|
92
94
|
}
|
93
95
|
}
|
94
96
|
}
|
95
|
-
|
97
|
+
|
98
|
+
// Bold Variant
|
99
|
+
&[class*=_bold] {
|
100
|
+
@include bold;
|
101
|
+
// Horizontal Overrides
|
102
|
+
[class*=pb_nav_list_kit_item] {
|
103
|
+
margin: 0;
|
104
|
+
}
|
105
|
+
[class*=_active] {
|
106
|
+
[class*=_text] {
|
107
|
+
color: $white;
|
108
|
+
}
|
109
|
+
}
|
110
|
+
}
|
111
|
+
|
96
112
|
&[class*=dark]{
|
97
113
|
[class*=pb_nav_list_kit_item]{
|
98
114
|
[class*=_link]{
|
@@ -6,6 +6,8 @@
|
|
6
6
|
@import "../tokens/titles";
|
7
7
|
@import "../pb_body/body_mixins";
|
8
8
|
@import "./subtle_mixin";
|
9
|
+
@import "./bold_mixin";
|
10
|
+
@import "../tokens/shadows";
|
9
11
|
|
10
12
|
$selector: ".pb_nav_list";
|
11
13
|
|
@@ -87,12 +89,17 @@ $selector: ".pb_nav_list";
|
|
87
89
|
}
|
88
90
|
|
89
91
|
// Subtle Variant
|
90
|
-
&[class*=_subtle]
|
92
|
+
&[class*=_subtle] {
|
91
93
|
@include subtle;
|
92
94
|
}
|
93
95
|
|
96
|
+
// Bold Variant
|
97
|
+
&[class*=_bold] {
|
98
|
+
@include bold;
|
99
|
+
}
|
100
|
+
|
94
101
|
// Show Highlight
|
95
|
-
&[class*=_highlight]
|
102
|
+
&[class*=_highlight] {
|
96
103
|
[class*=_active] {
|
97
104
|
background-color: $active_light;
|
98
105
|
}
|
@@ -0,0 +1,6 @@
|
|
1
|
+
<%= pb_rails("nav", props: { orientation: "horizontal", variant: "bold" }) do %>
|
2
|
+
<%= pb_rails("nav/item", props: { text: "About", link: "#" }) %>
|
3
|
+
<%= pb_rails("nav/item", props: { text: "Case Studies", link: "#", active: true }) %>
|
4
|
+
<%= pb_rails("nav/item", props: { text: "Service ", link: "#" }) %>
|
5
|
+
<%= pb_rails("nav/item", props: { text: "Contacts", link: "#" }) %>
|
6
|
+
<% end %>
|