Skip to content

Commit

Permalink
CORE-4567: reader logo section
Browse files Browse the repository at this point in the history
  • Loading branch information
ekachxaidze98 committed Dec 5, 2023
1 parent 8586f46 commit fbda46d
Show file tree
Hide file tree
Showing 12 changed files with 9,007 additions and 29,151 deletions.
2 changes: 1 addition & 1 deletion .lintstagedrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"*.{js,jsx}": ["npm run lint:js -- --fix", "git add"],
"*.{json,scss,css}": ["npm run lint:css -- --write", "git add"]
"*.{scss,css}": ["npm run lint:css -- ", "git add"]
}
37,732 changes: 8,708 additions & 29,024 deletions package-lock.json

Large diffs are not rendered by default.

7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,18 @@
"@sentry/browser": "^5.29.2",
"@sentry/node": "^5.29.2",
"@zeit/next-workers": "^1.0.0",
"canvas": "^2.11.2",
"core-js": "^3.8.1",
"cssnano": "^4.1.10",
"file-saver": "^2.0.5",
"fit-curve": "^0.2.0",
"next": "^10.0.3",
"next-transpile-modules": "^6.0.0",
"pdfjs-dist": "^2.4.456",
"postcss": "^8.2.1",
"postcss": "8.4.14",
"postcss-extend": "^1.0.5",
"postcss-preset-env": "^6.7.0",
"postcss-extend-rule": "^4.0.0",
"postcss-preset-env": "^7.7.2",
"react": "^17.0.1",
"react-dom": "^17.0.1",
"react-ga": "^3.3.0",
Expand Down
26 changes: 26 additions & 0 deletions reader/components/logo/index.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import Icon from '@oacore/design/lib/elements/icon'
import { classNames } from '@oacore/design/lib/utils'
import React from 'react'

import styles from './styles.module.css'

const DataProviderLogo = ({
alt,
imageSrc,
size = 'md',
useDefault = true,
}) => (
<div
className={classNames.use(styles.circle, styles[size], {
[styles.hidden]: !useDefault,
})}
>
{imageSrc ? (
<img src={imageSrc} alt={alt} className={styles.image} />
) : (
<Icon src="#office-building" className={styles.image} />
)}
</div>
)

export default DataProviderLogo
23 changes: 23 additions & 0 deletions reader/components/logo/styles.module.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
.circle {
position: relative;
display: flex;
align-items: center;
justify-content: center;
width: 88px;
height: 88px;
padding: 0.1rem;
border: 1px solid var(--primary);
border-radius: 50%;
}

.image {
width: 100%;
height: 100%;
color: var(--gray-700);
object-fit: contain;
border-radius: 50%;
}

.hidden {
display: none;
}
5 changes: 3 additions & 2 deletions reader/components/main-area/index.jsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import React from 'react'
import { classNames } from '@oacore/design/lib/utils'

import Viewer from '../viewer'
import PdfLoader from '../pdf-loader/pdf-loader'
import ThumbnailSidebar from '../thumbnails-sidebar'
import OutlineSidebar from '../outline-sidebar'
import { useGlobalStore } from '../../store'
import { setDocument } from '../../store/document/actions'
import styles from './styles.module.css'
import Viewer from '../viewer/index'

const MainArea = () => {
const MainArea = ({ members }) => {
const [{ metadata, ui, document }, dispatch] = useGlobalStore()

return (
Expand All @@ -31,6 +31,7 @@ const MainArea = () => {
metadata={metadata}
setDocument={(d) => dispatch(setDocument(d))}
globalDispatch={dispatch}
members={members}
/>
</PdfLoader>
</div>
Expand Down
7 changes: 6 additions & 1 deletion reader/components/outline-sidebar/outline-renderer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,12 @@ const OutlineItem = ({ isExpanded, item, linkService }) => {
const [isOpen, toggleIsOpen] = useState(isExpanded)

return (
<li className={styles.outlineItem} role="treeitem" aria-expanded={isOpen}>
<li
className={styles.outlineItem}
role="treeitem"
aria-expanded={isOpen}
aria-selected={isOpen}
>
{Boolean(item.items.length) && (
<button
type="button"
Expand Down
5 changes: 3 additions & 2 deletions reader/components/recommender/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,11 @@ const Recommender = React.memo(({ containerWidth }) => {
}

const instance = recommenderRef.current
if (recommenderRef.current) observer.current.observe(recommenderRef.current)

if (instance) observer.current.observe(instance)

return () => {
observer.current.unobserve(instance?.current)
if (instance) observer.current.unobserve(instance)
}
}, [recommenderRef])

Expand Down
Loading

0 comments on commit fbda46d

Please sign in to comment.