Skip to content
Open
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
1 change: 1 addition & 0 deletions src/components/ExploreMore.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ limitations under the License.
--ifm-button-background-color: white !important;
--ifm-button-border-radius: 15% 0 / 100% 0;
margin-bottom: 20px;
transition: 0.5s;
}

.exploreMore:hover {
Expand Down
43 changes: 27 additions & 16 deletions src/components/Repositories.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,46 +13,57 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

import React, { useRef, useState } from "react";
import React, { useRef, useState, useEffect } from "react";
import styles from "./Repositories.module.css";
import clsx from "clsx";
import Repository from "./Repository";
import ExploreMore from "./ExploreMore";
import Paginator from "./Paginator";

function Repositories({reposData, reposConfig, showOnlyFeatured = false}) {
function Repositories({ reposData, reposConfig, showOnlyFeatured = false }) {
const allRepos = reposData.filter(repo => showOnlyFeatured ? repo.featured : true)
.sort((repo1, repo2) => repo1.name.localeCompare(repo2.name));
const pageCount = Math.ceil(allRepos.length / reposConfig.repositoriesPerPage);
const getPageRepos = (page) =>
allRepos.slice(page * reposConfig.repositoriesPerPage, (page + 1) * reposConfig.repositoriesPerPage);

const [currentRepos, setCurrentRepos] = useState(getPageRepos(0));
const [isVisible, setIsVisible] = useState(false);
const thisElementRef = useRef();

const handlePageClick = (event) => {
setIsVisible(false);
setCurrentRepos(getPageRepos(event.selected));
thisElementRef.current.scrollIntoView()
thisElementRef.current.scrollIntoView();
};

useEffect(() => {
setIsVisible(true);
}, [currentRepos]);

return (
<section ref={thisElementRef}
className={clsx(styles.repositoriesSection, showOnlyFeatured && styles.featuredRepositories)}>
<CurrentPageRepositories repos={currentRepos}/>
<Paginator pageCount={pageCount} handlePageClick={handlePageClick}/>
<ExploreMore text={showOnlyFeatured ? reposConfig.exploreMoreText : reposConfig.exploreOnGithubText}
link={showOnlyFeatured ? reposConfig.repositoriesPage.link : reposConfig.githubReposLink}/>
<section
ref={thisElementRef}
className={clsx(styles.repositoriesSection, showOnlyFeatured && styles.featuredRepositories)}
>
<CurrentPageRepositories repos={currentRepos} isVisible={isVisible} />
<Paginator pageCount={pageCount} handlePageClick={handlePageClick} />
<ExploreMore
text={showOnlyFeatured ? reposConfig.exploreMoreText : reposConfig.exploreOnGithubText}
link={showOnlyFeatured ? reposConfig.repositoriesPage.link : reposConfig.githubReposLink}
/>
</section>
)
);
}

function CurrentPageRepositories({repos}) {
function CurrentPageRepositories({ repos, isVisible }) {
return (
<div className={clsx('container', styles.repositoriesContainer)}>
<div className={clsx('container', styles.repositoriesContainer, { visible: isVisible })}>
<div className="row">
{ repos.map(repo => (<Repository key={repo.name} {...repo} />)) }
{repos.map(repo => (<Repository key={repo.name} {...repo} />))}
</div>
</div>
)
);
}

export default Repositories;
export default Repositories;
5 changes: 5 additions & 0 deletions src/components/Repositories.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

html {
scroll-behavior: smooth; /* Enable smooth scrolling */
}


.repositoriesSection {
display: flex;
Expand Down
6 changes: 5 additions & 1 deletion src/components/Social.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,13 @@ limitations under the License.
}

.social .socialColumn {
margin-bottom: 1rem;
margin-bottom: 1rem;
transition: transform 0.3s;
}

.social .socialColumn:hover {
transform: scale(1.02);
}
.socialHeaderAndBody {
--social-border-color: rgb(126, 220, 186);
--social-border-size: 5px;
Expand Down
4 changes: 4 additions & 0 deletions src/css/global.css
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,12 @@ limitations under the License.
}
.navbar__toggle {
color: var(--ifm-navbar-link-color);
transition: 0.15s;
}

.navbar__toggle:hover{
color: var( --anchor-hover-color);
}
/**
* Menu side bar
*/
Expand Down