Skip to content

Commit

Permalink
T244850 scrolldown arrow (#170)
Browse files Browse the repository at this point in the history
* Add arrow down icon to lead image page

* Update icon color to #72777D

* Fix indicator width & height

* adding test for indicator

Co-authored-by: Jose Pita <[email protected]>
  • Loading branch information
hueitan and jpita authored Mar 12, 2020
1 parent 8046005 commit ff89e2a
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 1 deletion.
15 changes: 15 additions & 0 deletions cypress/integration/article-view-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,21 @@ describe('Article view', () => {
cy.enter()
articlePage.getArticleText().should('have.attr', 'style', 'font-size: 14px;')
})

it('check down arrow to hint user to use dpad down', () => {
goToCatArticle()
articlePage.getDownArrowIndicator().should('be.visible')
cy.downArrow()
articlePage.getDownArrowIndicator().should('not.be.visible')
})

it('check down arrow doesnt show', () => {
cy.navigateToPageWithoutOnboarding('article/en/Catt')
articlePage.title().should('have.text', 'Catt')
articlePage.getDownArrowIndicator().should('not.be.visible')
cy.downArrow()
articlePage.getDownArrowIndicator().should('not.be.visible')
})
})

function goToCatArticle () {
Expand Down
4 changes: 4 additions & 0 deletions cypress/page-objects/article-page.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,8 @@ export class ArticlePage {
increaseTextSize () {
cy.get('body').type('6')
}

getDownArrowIndicator () {
return cy.get('div.indicator>img')
}
}
5 changes: 5 additions & 0 deletions images/icon-down-arrow.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 6 additions & 1 deletion src/components/Article.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ const ArticleSection = ({

const introNode = contentRef.current.querySelector('.intro')
let introHeight = introNode.getBoundingClientRect().height
introHeight += 34 // Magic number needed to make it work
introHeight += 21 // Magic number needed to make it work
const articleSectionHeight = contentRef.current.getBoundingClientRect().height
const marginTop = articleSectionHeight - introHeight

Expand All @@ -105,6 +105,11 @@ const ArticleSection = ({
</Fragment>
) }
{ actions && <ArticleActions actions={actions} /> }
{ imageUrl && (
<div class='indicator'>
<img src='images/icon-down-arrow.svg' />
</div>
) }
</div>
{ isFooter
? <ArticleFooter lang={lang} title={articleTitle} items={suggestedArticles} />
Expand Down
11 changes: 11 additions & 0 deletions style/article.less
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,17 @@
color: #323438;
}

.indicator {
width: 100%;
position: relative;
text-align: center;

img {
width: 20px;
height: 20px;
}
}

.article-actions {
display: flex;
justify-content: space-around;
Expand Down

0 comments on commit ff89e2a

Please sign in to comment.