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

Commit e2d6711

Browse files
author
Kerry Archibald
committed
extract reusable styles live beacon icon
Signed-off-by: Kerry Archibald <[email protected]>
1 parent 8cd805a commit e2d6711

File tree

5 files changed

+64
-11
lines changed

5 files changed

+64
-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: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
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+
// 20% brightness $location-live-color
27+
border-color: #deddfd;
28+
padding: 2px;
29+
// colors icon
30+
color: white;
31+
}

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;
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)