@ndla/ui 37.1.3 → 37.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/AudioPlayer/Controls.js +68 -88
- package/lib/AudioPlayer/Controls.js +68 -88
- package/package.json +3 -2
- package/src/AudioPlayer/Controls.tsx +21 -33
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ndla/ui",
|
|
3
|
-
"version": "37.1.
|
|
3
|
+
"version": "37.1.4",
|
|
4
4
|
"description": "UI component library for NDLA.",
|
|
5
5
|
"license": "GPL-3.0",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -31,6 +31,7 @@
|
|
|
31
31
|
"types"
|
|
32
32
|
],
|
|
33
33
|
"dependencies": {
|
|
34
|
+
"@headlessui/react": "^1.7.14",
|
|
34
35
|
"@ndla/accordion": "^2.2.3",
|
|
35
36
|
"@ndla/article-scripts": "^3.0.17",
|
|
36
37
|
"@ndla/button": "^10.1.2",
|
|
@@ -86,5 +87,5 @@
|
|
|
86
87
|
"publishConfig": {
|
|
87
88
|
"access": "public"
|
|
88
89
|
},
|
|
89
|
-
"gitHead": "
|
|
90
|
+
"gitHead": "77675e3df78c7dd48d9790cdd1adfceab56e355e"
|
|
90
91
|
}
|
|
@@ -10,6 +10,7 @@ import React, { useEffect, useRef, useState } from 'react';
|
|
|
10
10
|
import styled from '@emotion/styled';
|
|
11
11
|
import { Menu, MenuButton, MenuItem, MenuPopover, MenuItems, MenuItemProps } from '@reach/menu-button';
|
|
12
12
|
import { SliderInput, SliderTrack, SliderRange, SliderHandle, SliderOrientation } from '@reach/slider';
|
|
13
|
+
import { Popover } from '@headlessui/react';
|
|
13
14
|
import { Play, Pause, VolumeUp } from '@ndla/icons/common';
|
|
14
15
|
import { breakpoints, colors, fonts, misc, mq, spacing } from '@ndla/core';
|
|
15
16
|
import { useTranslation } from 'react-i18next';
|
|
@@ -235,7 +236,7 @@ const ProgressHandle = styled(SliderHandle)`
|
|
|
235
236
|
top: -8px;
|
|
236
237
|
`;
|
|
237
238
|
|
|
238
|
-
const VolumeWrapper = styled
|
|
239
|
+
const VolumeWrapper = styled(Popover)`
|
|
239
240
|
position: relative;
|
|
240
241
|
display: flex;
|
|
241
242
|
justify-content: center;
|
|
@@ -256,7 +257,7 @@ const WardButtonWrapper = styled.div<{ order: number }>`
|
|
|
256
257
|
}
|
|
257
258
|
`;
|
|
258
259
|
|
|
259
|
-
const VolumeButton = styled(
|
|
260
|
+
const VolumeButton = styled(Popover.Button)`
|
|
260
261
|
background-color: inherit;
|
|
261
262
|
width: 48px;
|
|
262
263
|
height: 48px;
|
|
@@ -280,13 +281,10 @@ const VolumeButton = styled(MenuButton)`
|
|
|
280
281
|
}
|
|
281
282
|
`;
|
|
282
283
|
|
|
283
|
-
const
|
|
284
|
+
const VolumeList = styled(Popover.Panel)`
|
|
284
285
|
position: absolute;
|
|
285
286
|
bottom: 52px;
|
|
286
287
|
z-index: 99;
|
|
287
|
-
`;
|
|
288
|
-
|
|
289
|
-
const VolumeList = styled.div`
|
|
290
288
|
box-shadow: 0 14px 20px -5px rgba(32, 88, 143, 0.17);
|
|
291
289
|
border-radius: 60px;
|
|
292
290
|
background: #ffffff;
|
|
@@ -507,33 +505,23 @@ const Controls = ({ src, title }: Props) => {
|
|
|
507
505
|
<Time>-{formatTime(remainingTime)}</Time>
|
|
508
506
|
</ProgressWrapper>
|
|
509
507
|
<VolumeWrapper>
|
|
510
|
-
<
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
>
|
|
528
|
-
<VolumeSliderBackground as="div">
|
|
529
|
-
<VolumeSliderSelected as="div" />
|
|
530
|
-
<VolumeSliderHandle as="div" />
|
|
531
|
-
</VolumeSliderBackground>
|
|
532
|
-
</SliderInput>
|
|
533
|
-
</VolumeSliderWrapper>
|
|
534
|
-
</VolumeList>
|
|
535
|
-
</VolumeMenu>
|
|
536
|
-
</Menu>
|
|
508
|
+
<VolumeButton aria-label={t('audio.controls.adjustVolume')}>
|
|
509
|
+
<VolumeUp />
|
|
510
|
+
</VolumeButton>
|
|
511
|
+
<VolumeList>
|
|
512
|
+
<VolumeSliderWrapper>
|
|
513
|
+
<SliderInput
|
|
514
|
+
orientation={SliderOrientation.Vertical}
|
|
515
|
+
onChange={handleVolumeSliderChange}
|
|
516
|
+
value={volumeValue}
|
|
517
|
+
>
|
|
518
|
+
<VolumeSliderBackground as="div">
|
|
519
|
+
<VolumeSliderSelected as="div" />
|
|
520
|
+
<VolumeSliderHandle as="div" />
|
|
521
|
+
</VolumeSliderBackground>
|
|
522
|
+
</SliderInput>
|
|
523
|
+
</VolumeSliderWrapper>
|
|
524
|
+
</VolumeList>
|
|
537
525
|
</VolumeWrapper>
|
|
538
526
|
</ControlsWrapper>
|
|
539
527
|
</div>
|