Skip to content

Commit

Permalink
OwnerCard styling and small fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
quterma committed Feb 10, 2025
1 parent e69240c commit 14a71be
Show file tree
Hide file tree
Showing 29 changed files with 303 additions and 42 deletions.
Binary file removed public/fonts/Inter-VariableFont_opsz,wght.ttf
Binary file not shown.
Binary file not shown.
Binary file removed public/fonts/Literata-VariableFont_opsz,wght.ttf
Binary file not shown.
Binary file removed public/fonts/Onest-VariableFont_wght.ttf
Binary file not shown.
Binary file added public/mocks/mockAvatar.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/statsIcon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/fonts/Inter-Medium.ttf
Binary file not shown.
Binary file added src/fonts/Inter-Regular.ttf
Binary file not shown.
Binary file added src/fonts/Literata-Regular.ttf
Binary file not shown.
15 changes: 15 additions & 0 deletions src/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
src: url("./fonts/Literata-Medium.woff") format("woff");
}

@font-face {
font-family: "Literata-Regular";
src: url("./fonts/Literata-Regular.ttf") format("ttf");
}

@font-face {
font-family: "Onest-Medium";
src: url("./fonts/Onest-Medium.woff") format("woff");
Expand All @@ -12,3 +17,13 @@
font-family: "Onest-Regular";
src: url("./fonts/Onest-Regular.woff") format("woff");
}

@font-face {
font-family: "Inter-Medium";
src: url("./fonts/Inter-Medium.ttf") format("ttf");
}

@font-face {
font-family: "Inter-Regular";
src: url("./fonts/Inter-Regular.ttf") format("ttf");
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Typography } from "antd";
import styles from "./styles.module.scss";
import { BookDescriptionProps } from "../../../../../../types/books";
import { BookDescriptionProps } from "../../../../../../types/book";

const { Title, Paragraph, Text } = Typography;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,29 @@
display: flex;
flex-direction: column;
gap: 40px;
width: 620px;
max-width: 620px;
}

.annotation {
:global(h3.ant-typography) {
margin: 10px 0 15px;
font-family: "Onest", sans-serif;
font-family: "Onest-Regula", sans-serif;
font-weight: 600;
font-size: 24px;
line-height: 31px;
color: var(--ant-color-text);
}

.annotationText {
font-family: "Literata", serif;
font-family: "Literata-Regular", serif;
font-weight: 400;
font-size: 16px;
line-height: 135%;
color: var(--ant-color-text);
}

.expandButton {
font-family: "Literata", serif;
font-family: "Literata-Regular", serif;
color: var(--ant-color-primary);
cursor: pointer;
border: none;
Expand All @@ -41,16 +41,16 @@

.detailItem {
display: flex;
gap: 40px;
gap: 20px;

:global(.ant-typography) {
font-family: "Onest", sans-serif;
font-family: "Onest-Regular", sans-serif;
font-size: 16px;
line-height: 20px;
}

.label {
width: 97px;
width: 120px;
color: var(--ant-color-text-placeholder);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
border-radius: 7px;

span {
font-family: "Onest", sans-serif;
font-family: "Onest-Medium", sans-serif;
font-weight: 500;
font-size: 17px;
line-height: 22px;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
import { Avatar, Card, Typography, Button, Image, Divider } from "antd";
import { EnvironmentOutlined } from "@ant-design/icons";
import styles from "./styles.module.scss";
import { OwnerCardProps } from "../../../../../../types/user";
import { getMembershipTime } from "../../../../../../utils/date";
import { ExchangeInfoIcon } from "./svg-icons";

const { Text } = Typography;

const mockOwnerData: OwnerCardProps = {
name: "Евгения",
avatar: "/mocks/mockAvatar.png",
registrationDate: new Date("2023-08-09"),
booksGiven: 17,
booksExchanged: 21,
gender: "female",
location: "Санкт-Петербург, Озерки",
isMessageAvailable: true,
};

export const OwnerCard = () => {
const {
name,
avatar,
gender,
location,
isMessageAvailable,
booksGiven,
booksExchanged,
} = mockOwnerData;

const membershipTime = getMembershipTime(mockOwnerData.registrationDate);

return (
<Card className={styles.card}>
<div className={styles.header}>
<Avatar size={50} src={avatar} />
<div className={styles.userInfo}>
<Text className={styles.name}>{name}</Text>
<Text className={styles.membershipTime}>{membershipTime}</Text>
</div>
</div>

<div className={`${styles.detailsRow} ${styles.statsRow}`}>
<div className={styles.iconWrapper}>
<Image
src="/statsIcon.png"
preview={false}
width={24}
height={24}
className={styles.statsIcon}
/>
</div>
<Text className={styles.statsText}>
Отдано {booksGiven} книг • Обменяно {booksExchanged}
</Text>
</div>

<div className={styles.detailsRow}>
<div className={styles.iconWrapper}>
<ExchangeInfoIcon className={styles.exchangeInfoIcon} />
</div>
<Text className={styles.exchangeInfoText}>
{name} {gender === "female" ? "готова" : "готов"} обменять книгу на
любую интересную
</Text>
</div>

<div className={styles.detailsRow}>
<div className={styles.iconWrapper}>
<EnvironmentOutlined className={styles.locationIcon} />
</div>
<Text className={styles.location}>{location}</Text>
</div>

<Divider className={styles.divider} />

<Button
type="primary"
className={styles.messageButton}
disabled={!isMessageAvailable}
>
Написать
</Button>
</Card>
);
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
.card {
width: 315px;
border: 1px solid rgba(158, 158, 158, 0.2);
box-shadow: 0px 0px 12px 5px rgba(66, 66, 66, 0.05);
border-radius: 15px;
padding: 15px;

:global(.ant-card-body) {
display: flex;
flex-direction: column;
gap: 12px;

&::before,
&::after {
display: none;
}
}
}

.header {
display: flex;
gap: 14px;
}

.userInfo {
display: flex;
flex-direction: column;
justify-content: center;
gap: 2px;
}

.name {
font-family: "Onest-Medium", sans-serif;
font-size: 16px;
line-height: 18px;
font-weight: 500;
color: var(--ant-color-text);
}

.membershipTime {
font-family: "Onest-Regular", sans-serif;
font-size: 14px;
line-height: 16px;
color: var(--ant-color-text-placeholder);
}

.detailsRow {
display: flex;
gap: 8px;

.iconWrapper {
display: flex;
width: 24px;
flex-shrink: 0;
}
}

.statsRow {
padding-bottom: 3px;
align-items: flex-end;
}

.statsIcon {
display: block;
}

.statsText {
font-family: "Onest-Medium", sans-serif;
font-size: 16px;
line-height: 18px;
font-weight: 500;
color: var(--ant-color-text);
}

.exchangeInfoText {
font-family: "Onest-Regular", sans-serif;
font-size: 16px;
line-height: 19px;
color: var(--ant-color-text-placeholder);
}

.locationIcon {
font-size: 18px;
color: var(--ant-color-text-quaternary);
}

.location {
font-family: "Onest-Regular", sans-serif;
font-size: 14px;
line-height: 18px;
color: var(--ant-color-text-placeholder);
}

.divider {
height: 1px;
background-color: var(--ant-color-border-bg);
width: 100%;

&:global(.ant-divider-horizontal) {
margin: 2px 0;
}
}

.messageButton {
width: 100%;
height: 42px;
border-radius: 9px;
font-family: "Onest-Medium", sans-serif;
font-weight: 500;
font-size: 16px;
line-height: 20px;

&:global(.ant-btn-variant-solid:hover) {
&:hover {
background-color: var(--ant-geekblue-6); //В фигме #355FFF
}
}

&:global(.ant-btn-variant-solid:disabled) {
color: var(--ant-color-bg-base);
background-color: var(--ant-color-primary-text-hover); //В фигме #5A9CFF

&:hover {
color: var(--ant-color-bg-base);
background-color: var(--ant-color-primary-text-hover);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
export const ExchangeInfoIcon = ({ className }: { className?: string }) => (
<svg
width="18"
height="18"
viewBox="0 0 18 18"
fill="none"
xmlns="http://www.w3.org/2000/svg"
className={className}
>
<path
d="M3 12.75L15 12.75M15 12.75L12.75 15M15 12.75L12.75 10.5"
stroke="#909090"
strokeWidth="1.125"
strokeLinecap="round"
strokeLinejoin="round"
/>
<path
d="M15 5.25L3 5.25M3 5.25L5.25 7.5M3 5.25L5.25 3"
stroke="#909090"
strokeWidth="1.125"
strokeLinecap="round"
strokeLinejoin="round"
/>
</svg>
);
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const shareMenu = {
],
};

export const ShareButton = () => (
export const ShareDropdown = () => (
<Dropdown
menu={shareMenu}
trigger={["click"]}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
}

span:last-child {
font-family: "Onest", sans-serif;
font-family: "Onest-Regular", sans-serif;
font-size: 16px;
line-height: 20px;
font-weight: 400;
Expand Down Expand Up @@ -66,7 +66,7 @@
}

span {
font-family: "Onest", sans-serif;
font-family: "Onest-Regula", sans-serif;
font-size: 14px;
line-height: 18px;
font-weight: 400;
Expand Down
Loading

0 comments on commit 14a71be

Please sign in to comment.