Skip to content

Commit

Permalink
feat: New Footer (fix #2518)
Browse files Browse the repository at this point in the history
  • Loading branch information
tofumatt committed Jun 12, 2017
1 parent f734390 commit 864469b
Show file tree
Hide file tree
Showing 11 changed files with 197 additions and 130 deletions.
66 changes: 0 additions & 66 deletions src/amo/components/Footer.js

This file was deleted.

32 changes: 0 additions & 32 deletions src/amo/components/Footer.scss

This file was deleted.

79 changes: 79 additions & 0 deletions src/amo/components/Footer/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
import React from 'react';
import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import { compose } from 'redux';

import LanguagePicker from 'amo/components/LanguagePicker';
import translate from 'core/i18n/translate';
import Icon from 'ui/components/Icon';

import './styles.scss';


export class FooterBase extends React.Component {
static propTypes = {
handleViewDesktop: PropTypes.func.isRequired,
i18n: PropTypes.object.isRequired,
lang: PropTypes.string.isRequired,
location: PropTypes.object.isRequired,
}

render() {
const { handleViewDesktop, i18n, lang, location } = this.props;
const homepageText = i18n.gettext("Go to Mozilla's homepage");

return (
<footer className="Footer">
<div className="Footer-language-and-links">
<LanguagePicker location={location}
ref={(ref) => { this.languagePicker = ref; }} />
<ul className="Footer-links">
<li>
<a href={`https://www.mozilla.org/${lang}/privacy/websites/`}
className="Footer-link Footer-privacy">
{i18n.gettext('Privacy policy')}
</a>
</li>
<li>
<a href={`https://www.mozilla.org/${lang}/about/legal/`}
className="Footer-link Footer-legal">
{i18n.gettext('Legal notices')}
</a>
</li>
<li>
<a href={'https://developer.mozilla.org/Add-ons/AMO/Policy/Contact'}
className="Footer-link Footer-fileissue">
{i18n.gettext('Report a bug')}
</a>
</li>
<li>
<a href="#desktop" className="Footer-link Footer-desktop"
onClick={handleViewDesktop}
ref={(ref) => { this.desktopLink = ref; }}>
{i18n.gettext('View classic desktop site')}
</a>
</li>
</ul>
</div>

<a
className="Footer-mozilla-link"
href="https://mozilla.org/"
title={homepageText}
>
<Icon className="Footer-mozilla-logo" name="mozilla" />
<span className="visually-hidden">{homepageText}</span>
</a>
</footer>
);
}
}

export function mapStateToProps(state) {
return { lang: state.api.lang };
}

export default compose(
connect(mapStateToProps),
translate({ withRef: true }),
)(FooterBase);
49 changes: 49 additions & 0 deletions src/amo/components/Footer/styles.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
@import "~core/css/inc/mixins";
@import "~amo/css/inc/vars";
@import "~ui/css/vars";

.Footer {
background: $footer-base-color;
color: $white;
padding: 20px;

@include respond-to(medium) {
display: flex;
justify-content: space-between;
}
}

.Footer-language-and-links {
max-width: 220px;
width: 100%;
}

.Footer-links {
list-style: none;
margin: 20px 0 0;
padding: 0;
}

.Footer-link,
.Footer-link:link {
color: $white;
display: block;
margin: 0 0 10px;
text-decoration: none;

&:active,
&:hover {
text-decoration: underline;
}
}

.Footer-mozilla-link {
display: inline-block;
margin-top: 10px;

@include respond-to(medium) {
@include margin-end(10px);

margin-top: auto;
}
}
26 changes: 13 additions & 13 deletions src/amo/components/LanguagePicker.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
@import "~amo/css/inc/vars";

$selector-padding: 10px;
@import "~ui/css/vars";

.LanguagePicker-header {
margin: 0 0 5px;
Expand All @@ -9,25 +8,26 @@ $selector-padding: 10px;
.LanguagePicker-selector {
appearance: none;
background:
url('../img/icons/globe.svg') no-repeat #{$selector-padding} 50%,
$base-color url('../img/icons/triangle-down.svg')
no-repeat calc(100% - #{$selector-padding}) 50%;
background-size: 20px 20px, 15px 15px;
url('~ui/components/Icon/globe.svg') no-repeat 10px 50%,
$neutral-base-color url('~ui/components/Icon/triangle-down.svg')
no-repeat calc(100% - 10px) 50%;
background-size: 16px, 12px;
border: 0;
border-radius: $border-radius-default;
color: $link-color;
color: $white;
display: block;
font-size: $font-size-s;
line-height: 1;
padding: $selector-padding $selector-padding #{$selector-padding - 1} #{$selector-padding * 3};
max-width: 220px;
padding: 5px 15px 3.5px 30px;
width: 100%;

[dir=rtl] & {
background:
url('../img/icons/globe.svg') no-repeat calc(100% - #{$selector-padding}) 50%,
$base-color url('../img/icons/triangle-down.svg')
no-repeat #{$selector-padding} 50%;
background-size: 20px 20px, 15px 15px;
padding: $selector-padding #{$selector-padding * 3} #{$selector-padding - 1} $selector-padding;
url('~ui/components/Icon/globe.svg') no-repeat calc(100% - 10px) 50%,
$neutral-base-color url('~ui/components/Icon/triangle-down.svg')
no-repeat 10px 50%;
background-size: 16px, 12px;
padding: 5px 30px 3.5px 15px;
}
}
13 changes: 0 additions & 13 deletions src/amo/img/icons/globe.svg

This file was deleted.

6 changes: 0 additions & 6 deletions src/amo/img/icons/triangle-down.svg

This file was deleted.

15 changes: 15 additions & 0 deletions src/ui/components/Icon/globe.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 20 additions & 0 deletions src/ui/components/Icon/mozilla.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions src/ui/components/Icon/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,13 @@
background-size: cover;
}

.Icon-mozilla {
background: url('./mozilla.svg') center no-repeat;
background-size: contain;
height: 32px;
width: 112px;
}

.Icon-user {
background: url('./user.svg') center no-repeat;
background-size: contain;
Expand Down
14 changes: 14 additions & 0 deletions src/ui/components/Icon/triangle-down.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 864469b

Please sign in to comment.