Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit 0b80755

Browse files
author
Kerry
authored
extract reusable styled live beacon icon (#8103)
* extract reusable styles live beacon icon Signed-off-by: Kerry Archibald <[email protected]> * add secondary live lcation color Signed-off-by: Kerry Archibald <[email protected]>
1 parent 8cd805a commit 0b80755

File tree

9 files changed

+67
-11
lines changed

9 files changed

+67
-11
lines changed

res/css/_components.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
@import "./_font-weights.scss";
66
@import "./_spacing.scss";
77
@import "./components/views/beacon/_LeftPanelLiveShareWarning.scss";
8+
@import "./components/views/beacon/_StyledLiveBeaconIcon.scss";
89
@import "./components/views/location/_LiveDurationDropdown.scss";
910
@import "./components/views/location/_LocationShareMenu.scss";
1011
@import "./components/views/location/_MapError.scss";
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/*
2+
Copyright 2022 The Matrix.org Foundation C.I.C.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
.mx_StyledLiveBeaconIcon {
18+
flex-grow: 0;
19+
flex-shrink: 0;
20+
box-sizing: border-box;
21+
border-width: 2px;
22+
border-style: solid;
23+
border-radius: 50%;
24+
25+
background-color: $location-live-color;
26+
border-color: $location-live-secondary-color;
27+
padding: 2px;
28+
// colors icon
29+
color: white;
30+
}

res/css/components/views/location/_ShareType.scss

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -83,19 +83,12 @@ limitations under the License.
8383
border-style: solid;
8484
border-radius: 50%;
8585

86+
// Live is styled by StyledLiveBeaconIcon
87+
8688
&.Own {
8789
border-color: $accent;
8890
}
8991

90-
&.Live {
91-
background-color: $location-live-color;
92-
// 20% brightness $location-live-color
93-
border-color: #deddfd;
94-
padding: 2px;
95-
// colors icon
96-
color: white;
97-
}
98-
9992
&.Pin {
10093
border-color: $accent;
10194
background-color: $accent;

res/themes/dark/css/_dark.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,7 @@ $video-feed-secondary-background: $system;
185185
// Location sharing
186186
// ********************
187187
$location-live-color: #5c56f5;
188+
$location-live-secondary-color: #deddfd;
188189
// ********************
189190

190191
// Location sharing

res/themes/legacy-dark/css/_legacy-dark.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,7 @@ $eventbubble-reply-color: #C1C6CD;
192192
// ********************
193193
$location-marker-color: #ffffff;
194194
$location-live-color: #5c56f5;
195+
$location-live-secondary-color: #deddfd;
195196
// ********************
196197

197198
// ***** Mixins! *****

res/themes/legacy-light/css/_legacy-light.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,7 @@ $groupFilterPanel-divider-color: $tertiary-content;
288288
// ********************
289289
$location-marker-color: #ffffff;
290290
$location-live-color: #5c56f5;
291+
$location-live-secondary-color: #deddfd;
291292
// ********************
292293

293294
// ***** Mixins! *****

res/themes/light/css/_light.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,7 @@ $copy-button-url: "$(res)/img/feather-customised/clipboard.svg";
302302
// ********************
303303
$location-marker-color: #ffffff;
304304
$location-live-color: #5c56f5;
305+
$location-live-secondary-color: #deddfd;
305306
// ********************
306307

307308
// Mixins
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
/*
2+
Copyright 2022 The Matrix.org Foundation C.I.C.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
import React from 'react';
18+
import classNames from 'classnames';
19+
20+
import { Icon as LiveLocationIcon } from '../../../../res/img/location/live-location.svg';
21+
22+
const StyledLiveBeaconIcon: React.FC<React.SVGProps<SVGSVGElement>> = ({ className, ...props }) =>
23+
<LiveLocationIcon
24+
{...props}
25+
className={classNames('mx_StyledLiveBeaconIcon', className)}
26+
/>;
27+
28+
export default StyledLiveBeaconIcon;

src/components/views/location/ShareType.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ import BaseAvatar from '../avatars/BaseAvatar';
2323
import AccessibleButton from '../elements/AccessibleButton';
2424
import Heading from '../typography/Heading';
2525
import { Icon as LocationIcon } from '../../../../res/img/element-icons/location.svg';
26-
import { Icon as LiveLocationIcon } from '../../../../res/img/location/live-location.svg';
2726
import { LocationShareType } from './shareLocation';
27+
import StyledLiveBeaconIcon from '../beacon/StyledLiveBeaconIcon';
2828

2929
const UserAvatar = () => {
3030
const matrixClient = useContext(MatrixClientContext);
@@ -59,7 +59,7 @@ const ShareTypeOption: React.FC<ShareTypeOptionProps> = ({
5959
{ shareType === LocationShareType.Pin &&
6060
<LocationIcon className={`mx_ShareType_option-icon ${LocationShareType.Pin}`} /> }
6161
{ shareType === LocationShareType.Live &&
62-
<LiveLocationIcon className={`mx_ShareType_option-icon ${LocationShareType.Live}`} /> }
62+
<StyledLiveBeaconIcon className={`mx_ShareType_option-icon ${LocationShareType.Live}`} /> }
6363

6464
{ label }
6565
</AccessibleButton>;

0 commit comments

Comments
 (0)