Skip to content

Commit

Permalink
[Topics/Orgs Header][m]: adds scrollbar to descriptions -- refs #116
Browse files Browse the repository at this point in the history
  • Loading branch information
demenech committed Sep 20, 2022
1 parent 4c3d700 commit eda417c
Show file tree
Hide file tree
Showing 3 changed files with 100 additions and 4 deletions.
23 changes: 19 additions & 4 deletions components/_shared/image_header/ImageHeader.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import Image from 'next/image';
import Scrollbar from 'react-scrollbars-custom';
import { AR } from '../../../hooks/locale';
import Badge from './Badge';
import Title from './Title';
Expand All @@ -20,6 +21,15 @@ const ImageHeader: React.FC<ImageHeaderProps> = ({
children,
color,
}) => {
let scrollbarCss;
if (color)
scrollbarCss = `
.ScrollbarsCustom-Thumb.ScrollbarsCustom-ThumbY {
background: ${color} !important;
opacity: 0.5;
}
`;

return (
<>
<div className={image?.url ? `xl:grid xl:grid-cols-2` : ''}>
Expand Down Expand Up @@ -71,13 +81,18 @@ const ImageHeader: React.FC<ImageHeaderProps> = ({
`}
>
<div className="pt-[3rem] flex flex-col h-full justify-between">
<div className="h-[13em]">
<div className="h-[13em] group">
<Title icon={icon} color={color}>
{title}
</Title>
<p className="w-full 2xl:w-[85%] text-[#7C7C7C] line-clamp-5 ">
{children}
</p>
<div className="w-full 2xl:w-[85%]">
<style>{scrollbarCss}</style>
<Scrollbar style={{ height: '7.5em' }}>
<p className="text-[#7C7C7C] w-[99%] line-clamp-5 group-hover:line-clamp-none transition-all">
{children}
</p>
</Scrollbar>
</div>
</div>
<div className="pb-[3rem]">
<Badge text={badgeText} color={color} />
Expand Down
80 changes: 80 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
"react-chartjs-2": "^4.3.1",
"react-datepicker": "^4.8.0",
"react-dom": "^17.0.2",
"react-scrollbars-custom": "^4.1.1",
"react-simple-star-rating": "^4.0.5",
"react-syntax-highlighter": "^15.5.0",
"react-tooltip": "^4.2.21",
Expand Down

0 comments on commit eda417c

Please sign in to comment.