Files
outline/app/scenes/Settings/components/ImageInput.tsx
Tom Moor d63326066f feat: Improve settings layout (#3234)
* Setup, and security settings

* Settings -> Details

* Settings -> Notifications

* Profile

* lint

* fix: Flash of loading on members screen

* align language input

* feat: Move share links management to sortable table

* Add account menu to sidebar on settings page

* Aesthetic tweaks, light borders between settings and slight column offset
2022-03-14 17:44:56 -07:00

62 lines
1.2 KiB
TypeScript

import * as React from "react";
import { useTranslation } from "react-i18next";
import styled from "styled-components";
import Flex from "~/components/Flex";
import ImageUpload, { Props as ImageUploadProps } from "./ImageUpload";
type Props = ImageUploadProps & {
src?: string;
};
export default function ImageInput({ src, ...rest }: Props) {
const { t } = useTranslation();
return (
<ImageBox>
<ImageUpload {...rest}>
<Avatar src={src} />
<Flex auto align="center" justify="center">
{t("Upload")}
</Flex>
</ImageUpload>
</ImageBox>
);
}
const avatarStyles = `
width: 64px;
height: 64px;
`;
const Avatar = styled.img`
${avatarStyles};
`;
const ImageBox = styled(Flex)`
${avatarStyles};
position: relative;
font-size: 14px;
border-radius: 8px;
box-shadow: 0 0 0 1px ${(props) => props.theme.secondaryBackground};
background: ${(props) => props.theme.background};
overflow: hidden;
div div {
${avatarStyles};
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
opacity: 0;
cursor: pointer;
transition: all 250ms;
}
&:hover div {
opacity: 1;
background: rgba(0, 0, 0, 0.75);
color: ${(props) => props.theme.white};
}
`;