Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

issue #205: GitHub repo link #221

Merged
merged 3 commits into from
Nov 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/locale/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,5 +68,6 @@
"mr_meir": "Mr. Asher Meir",
"innovation_authority": "Innovation Authority",
"migdal_company": "\"A tower in the community\"",
"and_smaller_donors": "And other small contributions from my friends and fans of the workshop."
"and_smaller_donors": "And other small contributions from my friends and fans of the workshop.",
"github_link": "Go to GitHub"
}
4 changes: 3 additions & 1 deletion src/locale/he.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,5 +68,7 @@
"innovation_authority": "רשות החדשנות",
"migdal_company": "“מגדל בקהילה“",
"and_smaller_donors": "ותרומות קטנות נוספות של ידידי ואוהדי הסדנא.",
"gaps_patterns_page_title": "דפוסי נסיעות שלא יצאו"
"gaps_patterns_page_title": "דפוסי נסיעות שלא יצאו",
"github_link": "למעבר אל GitHub"

}
12 changes: 12 additions & 0 deletions src/pages/components/header/sidebar/GitHubLink/GitHubLink.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
.github-link {
display: flex;
justify-content: center;
align-items: center;
font-size: 2em;
cursor: pointer;


&:hover {
transform: scale(1.1);
}
}
26 changes: 26 additions & 0 deletions src/pages/components/header/sidebar/GitHubLink/GitHubLink.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import React from 'react'
import { GithubOutlined } from '@ant-design/icons'
import { TEXT_KEYS } from 'src/resources/texts'
import { useTranslation } from 'react-i18next'
import './GitHubLink.scss'

export default function GitHubLink() {
const { t } = useTranslation()

const data = {
label: t(TEXT_KEYS.github_link),
path: 'https://github.com/hasadna/open-bus-map-search',
icon: <GithubOutlined />,
element: null,
}

const handleClick = () => {
window.open(data.path, '_blank')
}
Comment on lines +17 to +19
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const handleClick = () => {
window.open(data.path, '_blank')
}
const handleClick = useCallback(() => {
window.open(data.path, '_blank')
}, [])


return (
<div className="github-link" onClick={handleClick}>
{data.icon}
</div>
)
}
8 changes: 8 additions & 0 deletions src/pages/components/header/sidebar/SideBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import './sidebar.scss'
import { Drawer } from 'antd'
import { useContext } from 'react'
import { LayoutContextInterface, LayoutCtx } from 'src/layout/LayoutContext'
import GitHubLink from './GitHubLink/GitHubLink'

const Logo = () => (
<div style={{ overflow: 'hidden' }}>
Expand All @@ -22,11 +23,18 @@ export default function SideBar() {
onClose={() => setDrawerOpen(false)}
open={drawerOpen}
className="hideOnDesktop">
<Logo />
<div className="sidebar-divider"></div>
<Menu />
<div className="sidebar-divider"></div>
<GitHubLink />
</Drawer>
<aside className={'sidebar hideOnMobile'}>
<Logo />
<div className="sidebar-divider"></div>
<Menu />
<div className="sidebar-divider"></div>
<GitHubLink />
</aside>
</>
)
Expand Down
11 changes: 11 additions & 0 deletions src/pages/components/header/sidebar/sidebar.scss
Original file line number Diff line number Diff line change
Expand Up @@ -95,4 +95,15 @@
border-bottom: 8px solid gray;
padding-bottom: 0;
line-height: 25px;
}

.sidebar-section {
display: flex;
flex-direction: column;
}

.sidebar-divider {
height: 1px;
background-color: #ccc;
margin: 8px 0;
}
2 changes: 2 additions & 0 deletions src/resources/texts.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ export const TEXT_KEYS = {
migdal_company: 'migdal_company',
and_smaller_donors: 'and_smaller_donors',
gaps_patterns_page_title: 'gaps_patterns_page_title',
github_link: 'github_link',
}

export const TEXTS = {
Expand Down Expand Up @@ -179,6 +180,7 @@ export const TEXTS = {
show_document: 'הצג מידע לגיקים',
bearing: 'מעלות',
kmh: 'קמ״ש',
github_link: 'github_link',
}

export const formatted = (text: string, value: string) => text.replace(PLACEHOLDER, value)
Loading