Skip to content

Commit

Permalink
feature: user-preview description slide-content
Browse files Browse the repository at this point in the history
  • Loading branch information
Stepasha419a committed Sep 2, 2024
1 parent 44192cc commit ac22011
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 3 deletions.
7 changes: 7 additions & 0 deletions src/entities/user/lib/helpers/getUserSliderInfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,22 @@ export interface UserPlaceInfo extends UserInfo {

type UserListInfo = string[];

type UserDescription = string;

export type UserSliderInfo =
| UserInfo
| UserPlaceInfo
| UserListInfo
| UserDescription
| undefined;

export function getUserSliderInfo(user: User | ShortUser): UserSliderInfo[] {
const result: UserSliderInfo[] = [];

if (user.description) {
result.push(user.description);
}

result.push({
name: user.name,
age: user.age!,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
.wrapper {
max-width: calc(100% - 70px);
width: 100%;
height: 120px;
min-height: 120px;

position: absolute;
bottom: 100px;
left: 0;
z-index: 1;

letter-spacing: 0.7px;
padding: 5px 0 25px 20px;
padding: 5px 0 15px 20px;
cursor: pointer;
color: var(--color--white-100);

Expand All @@ -18,7 +18,8 @@
}

&.high {
height: 164px;
min-height: 120px;
padding: 5px 0 25px 20px;
}

.items {
Expand Down Expand Up @@ -76,6 +77,24 @@
margin: 0 7px 0 2px;
}
}

.longText {
font-size: 17px;
line-height: 130%;
font-weight: 300;

max-height: 120px;
-webkit-line-clamp: 5;

display: -webkit-box;
text-overflow: ellipsis;
-webkit-box-orient: vertical;
overflow: hidden;

word-wrap: break-word;
overflow-wrap: break-word;
word-break: break-word;
}
}

@media (max-width: 400px) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,17 @@ export const SliderContent: FC<SliderContentProps> = ({

const cn = classNames(styles.wrapper, disabled && styles.disabled);

if (typeof currentInfo === 'string') {
return (
<div className={cn}>
<div className={styles.person}>
{name} <span className={styles.years}>{age}</span>
</div>
<span className={styles.longText}>{currentInfo}</span>
</div>
);
}

if (Array.isArray(currentInfo)) {
return (
<div className={classNames(cn, styles.high)}>
Expand Down

0 comments on commit ac22011

Please sign in to comment.