Skip to content

Commit 60421db

Browse files
authored
718 configurable image (#726)
* configured image & border radius of widget * new signin image added * Fixed responsiveness of Signi page * Fixed responsiveness of Sign In page
1 parent 6cd3c92 commit 60421db

File tree

11 files changed

+40
-29
lines changed

11 files changed

+40
-29
lines changed

packages/messenger-demo/src/App.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ function App() {
1313
hideFunction: undefined, // OPTINAL PARAMETER : 'attachments,edit,delete' or undefined
1414
showContacts: true, // true for all contacts / false for default contact
1515
theme: undefined, // OPTINAL PARAMETER : undefined/themeColors
16+
signInImage: undefined, // OPTINAL PARAMETER : string URL of image
1617
};
1718

1819
return (

packages/messenger-widget/src/assets/base64/home-image.ts

+2-2
Large diffs are not rendered by default.

packages/messenger-widget/src/components/DM3/DM3.tsx

+3-2
Original file line numberDiff line numberDiff line change
@@ -149,16 +149,17 @@ function DM3(props: Dm3Props) {
149149
}, []);
150150

151151
return (
152-
<div id="data-rk-child" className="border-radius-8 h-100">
152+
<div id="data-rk-child" className="h-100">
153153
<Storage />
154154
{!isLoggedIn ? (
155155
<SignIn
156156
hideStorageSelection={props.config.hideStorageSelection}
157157
defaultStorageLocation={props.config.defaultStorageLocation}
158158
miniSignIn={props.config.miniSignIn}
159+
signInImage={props.config.signInImage as string}
159160
/>
160161
) : (
161-
<div className="h-100 rounded background-container">
162+
<div className="h-100 background-container">
162163
<Dashboard getContacts={getContacts} dm3Props={props} />
163164
</div>
164165
)}

packages/messenger-widget/src/components/RightHeader/RightHeader.css

-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88

99
.profile-name-container {
1010
padding: 0.5rem;
11-
border-top-right-radius: 8px;
1211
}
1312

1413
.default-profile-pic {

packages/messenger-widget/src/components/SignIn/SignIn.css

+18-14
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
11
.home-image-container {
2-
border-top-left-radius: 20px;
3-
border-bottom-left-radius: 20px;
4-
}
5-
6-
.signin-container {
7-
border-top-right-radius: 20px;
8-
border-bottom-right-radius: 20px;
2+
background-size: cover;
3+
background-repeat: no-repeat;
4+
background-position: center;
5+
height: 100%;
96
}
107

118
.content-data-container {
@@ -33,14 +30,9 @@
3330
margin-bottom: 0;
3431
}
3532

36-
.home-image {
37-
border-radius: 20px;
38-
height: 100%;
39-
}
40-
4133
.sign-in-logo {
42-
height: 4rem !important;
43-
width: fit-content !important;
34+
height: auto !important;
35+
width: 100% !important;
4436
fill: var(--text-primary-color) !important;
4537
}
4638

@@ -95,3 +87,15 @@
9587
margin-top: 1rem !important;
9688
}
9789
}
90+
91+
@media only screen and (max-height: 700px) {
92+
.content-data {
93+
margin-top: 1rem !important;
94+
}
95+
}
96+
97+
@media only screen and (max-width: 767px) {
98+
.home-image-container {
99+
height: 0% !important;
100+
}
101+
}

packages/messenger-widget/src/components/SignIn/SignIn.tsx

+10-8
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33
import { ConnectButton, useConnectModal } from '@rainbow-me/rainbowkit';
44
import { useContext } from 'react';
55
import { useAccount } from 'wagmi';
6-
import { homeImage } from '../../assets/base64/home-image';
76
import { AuthContext } from '../../context/AuthContext';
87
import { SignInProps } from '../../interfaces/web3';
98
import { ButtonState } from '../../utils/enum-type-utils';
109
import { LoginButton } from './LoginButton';
1110
import './SignIn.css';
1211
import { changeSignInButtonStyle } from './bl';
1312
import DM3Logo from './DM3Logo';
13+
import { signInImage } from '../../assets/base64/home-image';
1414

1515
export function SignIn(props: SignInProps) {
1616
const { address, isConnecting, isDisconnected, isConnected } = useAccount();
@@ -41,15 +41,17 @@ export function SignIn(props: SignInProps) {
4141
return (
4242
<>
4343
<div className="row m-0 p-0 h-100">
44-
<div className="h-100 col-lg-7 col-md-7 col-sm-12 p-0 home-image-container background-container">
45-
<img
46-
src={homeImage}
47-
className="img-fluid home-image w-100"
48-
/>
49-
</div>
44+
<div
45+
style={{
46+
backgroundImage: `url(${
47+
props.signInImage ?? signInImage
48+
})`,
49+
}}
50+
className="col-lg-7 col-md-7 col-sm-0 p-0 home-image-container background-container"
51+
></div>
5052
<div
5153
className="h-100 col-lg-5 col-md-5 col-sm-12 p-0 d-flex flex-column
52-
justify-content-center signin-container background-container"
54+
justify-content-center background-container"
5355
>
5456
<div className="d-flex justify-content-end rainbow-connect-btn">
5557
{isConnected ? (

packages/messenger-widget/src/interfaces/config.ts

+1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ export interface Config {
1818
ethereumProvider: string;
1919
walletConnectProjectId: string;
2020
hideFunction?: string;
21+
signInImage?: string;
2122
}
2223

2324
export interface Dm3Props {

packages/messenger-widget/src/interfaces/web3.ts

+1
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,5 @@ export interface SignInProps {
2020
hideStorageSelection: boolean;
2121
miniSignIn: boolean;
2222
defaultStorageLocation: StorageLocation | undefined;
23+
signInImage: string;
2324
}

packages/messenger-widget/src/utils/config-utils.ts

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { StorageLocation } from '@dm3-org/dm3-lib-storage';
22
import { Config } from '../interfaces/config';
3+
import { signInImage } from '../assets/base64/home-image';
34

45
// The default configuration of the app
56
const DefaultConfig: Config = {
@@ -19,6 +20,7 @@ const DefaultConfig: Config = {
1920
ethereumProvider: '' as string,
2021
walletConnectProjectId: '' as string,
2122
hideFunction: '',
23+
signInImage: signInImage,
2224
};
2325

2426
export function getConfig(overwrite: Partial<Config>): Config {

packages/messenger-widget/src/views/RightView/RightView.css

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
.chat-screen-container {
22
display: flex;
33
flex-direction: column;
4-
border-radius: 0px 8px 8px 0px;
4+
border-radius: 0px !important;
55
}
66

77
.right-view-outer-container {

packages/messenger-widget/src/views/RightView/RightView.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export default function RightView(props: HideFunctionProps) {
1515

1616
return (
1717
<>
18-
<div className="col-12 p-0 h-100 border-radius-8 background-chat chat-screen-container">
18+
<div className="col-12 p-0 h-100 background-chat chat-screen-container">
1919
<RightHeader showContacts={props.showContacts} />
2020
{state.uiView.selectedRightView ===
2121
RightViewSelected.Default && (

0 commit comments

Comments
 (0)