Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix upload image buttons for Profile component #171

Merged
merged 1 commit into from
Jul 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 18 additions & 34 deletions src/pages/CreateProject/components/Profile/Profile.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { Files, State, state } from "alem";
import CameraIcon from "@app/assets/svgs/CameraIcon";
import Button from "@app/components/Button";
import Image from "@app/components/mob.near/Image";
import constants from "@app/constants";
import uploadFileUpdateState from "../../utils/uploadFileUpdateState";
Expand Down Expand Up @@ -35,45 +34,30 @@ const Profile = () => {
<Container>
<BackgroundImage>
<Image image={backgroundImage} alt="profile background" fallbackUrl={IPFS_BASE_URL + fallbackImg} />
<Button type="standard" varient="outline" customClassName="btn-change-bg">
<Files
multiple={false}
accepts={["image/*"]}
minFileSize={1}
className="btn-change-bg"
clickable
onChange={handleBgChange}
>
<CameraIcon />
<span> Add cover photo</span>
<Files
multiple={false}
accepts={["image/*"]}
minFileSize={1}
style={{
zIndex: 1,
top: 0,
width: "100%",
height: "100%",
position: "absolute",
}}
clickable
onChange={handleBgChange}
/>
</Button>
</Files>
</BackgroundImage>
<ProfileImage>
<Image className="profile-image" image={profileImage} fallbackUrl={IPFS_BASE_URL + fallbackImg} />
<button className="btn-change-img">
<Files
multiple={false}
accepts={["image/*"]}
minFileSize={1}
className="btn-change-img"
clickable
onChange={handleImgChange}
>
<CameraIcon />
<Files
multiple={false}
accepts={["image/*"]}
minFileSize={1}
style={{
position: "absolute",
width: "100%",
height: "100%",
zIndex: 1,
left: 0,
top: 0,
}}
clickable
onChange={handleImgChange}
></Files>
</button>
</Files>
</ProfileImage>
</Container>
);
Expand Down
10 changes: 10 additions & 0 deletions src/pages/CreateProject/components/Profile/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,19 @@ export const BackgroundImage = styled.div`
line-height: 142%;
}
.btn-change-bg {
z-index: 10;
position: absolute;
bottom: 1.5rem;
right: 1.5rem;
background: white;
box-shadow: rgba(0, 0, 0, 0.22) 0px 0px 0px 1px inset, rgba(15, 15, 15, 0.15) 0px -1px 0px 0px inset,
rgba(5, 5, 5, 0.08) 0px 1px 2px -0.5px;
padding: 9px 16px;
display: flex;
gap: 8px;
border-radius: 6px;
transition: 200ms ease-in-out;
width: fit-content;
cursor: pointer;
svg {
width: 18px;
Expand Down
Loading