Skip to content

Commit

Permalink
fixed minor issues from PR feedback
Browse files Browse the repository at this point in the history
Signed-off-by: Allison Suarez Miranda <asuarezmiranda@lyft.com>
  • Loading branch information
allisonsuarez committed Aug 11, 2020
1 parent eed74c7 commit b1c141a
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 36 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const BROWSE_PAGE_DOCUMENT_TITLE = 'Browse - Amundsen';
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,13 @@ import * as DocumentTitle from 'react-document-title';
import TagsListContainer from 'components/Tags';

import './styles.scss';
import {BROWSE_PAGE_DOCUMENT_TITLE} from './constants';

export class BrowsePage extends React.Component {
render() {
return (
/* TODO: add expand/collapse behavior */
<DocumentTitle title="Browse - Amundsen">
<DocumentTitle title={BROWSE_PAGE_DOCUMENT_TITLE}>
<main className="container">
<div className="row">
<div className="col-xs-12">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@
margin-top: $spacer-4 * 2;
}

.title-1 {
margin-bottom: $spacer-2;
}

.filter-breadcrumb {
margin-top: 4px;

Expand Down
49 changes: 26 additions & 23 deletions amundsen_application/static/js/components/Tags/TagsList/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import * as React from 'react';
import { Link } from 'react-router-dom';

import ShimmeringTagListLoader from 'components/common/ShimmeringTagListLoader';

import TagInfo from 'components/Tags/TagInfo';
import { Tag } from 'interfaces';

Expand All @@ -16,6 +17,7 @@ import {
BROWSE_TAGS_TITLE,
BROWSE_PAGE_PATH,
} from './constants';

import './styles.scss';

export type TagsListProps = StateFromProps & OwnProps;
Expand All @@ -28,19 +30,21 @@ export interface StateFromProps {
}

interface OwnProps {
/* determine if we only want curated/popular tags with
'Browse more tags' link or the entire tags list */
shortTagsList?: boolean;
}

interface TagsListTitleProps {
titleText: string;
}

interface TagsListBlockProps {
tags: Tag[];
}

const TagsListTitle: React.FC<TagsListTitleProps> = ({
titleText,
}: TagsListTitleProps) => (
<h1 className="title-1" id="browse-header">
<h1 className="title-1 section-title" id="browse-header">
{titleText}
</h1>
);
Expand All @@ -53,10 +57,6 @@ const TagsListLabel: React.FC<TagsListTitleProps> = ({
</label>
);

interface TagsListBlockProps {
tags: Tag[];
}

const TagsListBlock: React.FC<TagsListBlockProps> = ({
tags,
}: TagsListBlockProps) => {
Expand All @@ -73,23 +73,23 @@ const ShortTagsList: React.FC<TagsListProps> = ({
curatedTags,
popularTags,
}: TagsListProps) => {
const hasCuratedTags = curatedTags.length > 0;
const hasPopularTags = popularTags.length > 0;
return (
<div className="short-tag-list">
{curatedTags.length === 0 && popularTags.length > 0 && (
{!hasCuratedTags && hasPopularTags && (
<TagsListTitle titleText={POPULAR_TAGS_TITLE} />
)}
{curatedTags.length > 0 && (
{hasCuratedTags && (
<TagsListTitle titleText={CURATED_TAGS_TITLE} />
)}
{curatedTags.length === 0 && popularTags.length > 0 && (
{!hasCuratedTags && hasPopularTags && (
<TagsListBlock tags={popularTags} />
)}
{curatedTags.length > 0 && <TagsListBlock tags={curatedTags} />}
<span>
<Link to={BROWSE_PAGE_PATH} className="browse-tags-link">
{BROWSE_MORE_TAGS_TEXT}
</Link>
</span>
{hasCuratedTags && <TagsListBlock tags={curatedTags} />}
<Link to={BROWSE_PAGE_PATH} className="browse-tags-link">
{BROWSE_MORE_TAGS_TEXT}
</Link>
</div>
);
};
Expand All @@ -99,22 +99,25 @@ const LongTagsList: React.FC<TagsListProps> = ({
popularTags,
otherTags,
}: TagsListProps) => {
const hasCuratedTags = curatedTags.length > 0;
const hasPopularTags = popularTags.length > 0;
const hasOtherTags = otherTags.length > 0;
return (
<div className="full-tag-list">
<TagsListTitle titleText={BROWSE_TAGS_TITLE} />
<TagsListTitle titleText={BROWSE_TAGS_TITLE}/>
<hr className="header-hr" />
{curatedTags.length === 0 && popularTags.length > 0 && (
{!hasCuratedTags && hasPopularTags && (
<TagsListLabel titleText={POPULAR_TAGS_TITLE} />
)}
{curatedTags.length > 0 && (
{hasCuratedTags && (
<TagsListLabel titleText={CURATED_TAGS_TITLE} />
)}
{curatedTags.length === 0 && popularTags.length > 0 && (
{!hasCuratedTags && hasPopularTags && (
<TagsListBlock tags={popularTags} />
)}
{curatedTags.length > 0 && <TagsListBlock tags={curatedTags} />}
{otherTags.length > 0 && <TagsListLabel titleText={OTHER_TAGS_TITLE} />}
{otherTags.length > 0 && <TagsListBlock tags={otherTags} />}
{hasCuratedTags && <TagsListBlock tags={curatedTags} />}
{hasOtherTags && <TagsListLabel titleText={OTHER_TAGS_TITLE} />}
{hasOtherTags && <TagsListBlock tags={otherTags} />}
</div>
);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,33 +3,37 @@

@import 'variables';

hr.header-hr {
$browse-tags-link-font-size: 16px;

.header-hr {
border: 2px solid $brand-color-4;
}

.section-title {
margin-bottom: $spacer-2;
}

.tags-list {
margin: 0 -4px;
}

@import 'variables';

.browse-tags-link {
font-size: 16px;
font-size: $browse-tags-link-font-size;
text-decoration: none;
display: block;
margin-top: $spacer-1;

&:hover,
&:link,
&:visited,
&:active,
&:link {
&:hover,
&:active {
text-decoration: none;
}
}

.section-label {
display: block;
font-weight: 400;
font-weight: $font-weight-body-regular;
margin-top: $spacer-3;
margin-bottom: $spacer-2;
}

0 comments on commit b1c141a

Please sign in to comment.