This repository has been archived by the owner on Jul 14, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 674
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #178 from mirumee/128/collections_view
Collection view, categories pagination, thumbnail update
- Loading branch information
Showing
55 changed files
with
1,089 additions
and
404 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,50 @@ | ||
import "./scss/index.scss"; | ||
|
||
import * as React from "react"; | ||
import { Link } from "react-router-dom"; | ||
|
||
import { getDBIdFromGraphqlId, slugify } from "../../core/utils"; | ||
import { Category_category } from "../../views/Category/types/Category"; | ||
import { baseUrl } from "../App/routes"; | ||
|
||
import "./scss/index.scss"; | ||
|
||
export interface Breadcrumb { | ||
value: string; | ||
link: string; | ||
} | ||
|
||
export const extractBreadcrumbs = (category: Category_category) => { | ||
const constructLink = item => ({ | ||
link: [ | ||
`/category`, | ||
`/${slugify(item.name)}`, | ||
`/${getDBIdFromGraphqlId(item.id, "Category")}/` | ||
].join(""), | ||
value: item.name | ||
}); | ||
|
||
let breadcrumbs = [constructLink(category)]; | ||
|
||
if (category.ancestors.edges.length) { | ||
const ancestorsList = category.ancestors.edges.map(constructLink); | ||
breadcrumbs = ancestorsList.concat(breadcrumbs); | ||
} | ||
return breadcrumbs; | ||
}; | ||
|
||
const Breadcrumbs: React.SFC<{ | ||
breadcrumbs: Breadcrumb[]; | ||
}> = ({ breadcrumbs }) => ( | ||
<ul className="breadcrumbs"> | ||
<li> | ||
<Link to={baseUrl}>Home</Link> | ||
</li> | ||
{breadcrumbs.map(breadcrumb => ( | ||
<li key={breadcrumb.value}> | ||
<Link to={breadcrumb.link}>{breadcrumb.value}</Link> | ||
}> = ({ breadcrumbs }) => { | ||
return ( | ||
<ul className="breadcrumbs"> | ||
<li> | ||
<Link to={baseUrl}>Home</Link> | ||
</li> | ||
))} | ||
</ul> | ||
); | ||
|
||
{breadcrumbs.map(breadcrumb => ( | ||
<li key={breadcrumb.value}> | ||
<Link to={breadcrumb.link}>{breadcrumb.value}</Link> | ||
</li> | ||
))} | ||
</ul> | ||
); | ||
}; | ||
export default Breadcrumbs; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.