-
-
-
-
-
-
+
+
+
+

+
+
+
+
+
{metadata.description}
-
{metadata.description}
- );
+ );
}
});
-var featuredContentStyle = {
- width: '100%',
- marginTop: '-8px',
-}, featuredContentLegendStyle = {
+var featuredContentLegendStyle = {
fontSize: '12px',
color: '#aaa',
verticalAlign: '15%',
@@ -218,56 +216,38 @@ var featuredContentStyle = {
var FeaturedContent = React.createClass({
render: function() {
- return (
+ return (
Featured Content
+
+
+
+
Community Content
-
-
-
-
-
-
-
- );
+ );
}
});
var DiscoverPage = React.createClass({
userTypingTimer: null,
+ componentDidUpdate: function() {
+ if (this.props.query)
+ {
+ lbry.search(this.props.query, this.searchCallback.bind(this, this.props.query));
+ }
+ },
+
componentDidMount: function() {
document.title = "Discover";
},
@@ -275,57 +255,29 @@ var DiscoverPage = React.createClass({
getInitialState: function() {
return {
results: [],
- searching: false,
- query: ''
+ searching: this.props.query && this.props.query.length > 0
};
},
- search: function() {
- if (this.state.query)
- {
- lbry.search(this.state.query, this.searchCallback.bind(this, this.state.query));
- }
- else
- {
- this.setState({
- searching: false,
- results: []
- });
- }
- },
-
searchCallback: function(originalQuery, results) {
+ console.log('search callback');
+ console.log(this.state);
if (this.state.searching) //could have canceled while results were pending, in which case nothing to do
{
this.setState({
results: results,
- searching: this.state.query != originalQuery, //multiple searches can be out, we're only done if we receive one we actually care about
+ searching: this.props.query != originalQuery, //multiple searches can be out, we're only done if we receive one we actually care about
});
}
},
- onQueryChange: function(event) {
- if (this.userTypingTimer)
- {
- clearTimeout(this.userTypingTimer);
- }
-
- //@TODO: Switch to React.js timing
- this.userTypingTimer = setTimeout(this.search, 800); // 800ms delay, tweak for faster/slower
-
- this.setState({
- searching: event.target.value.length > 0,
- query: event.target.value
- });
- },
-
render: function() {
return (
{ this.state.searching ? : null }
- { !this.state.searching && this.state.query && this.state.results.length ? : null }
- { !this.state.searching && this.state.query && !this.state.results.length ? : null }
- { !this.state.query && !this.state.searching ? : null }
+ { !this.state.searching && this.props.query && this.state.results.length ? : null }
+ { !this.state.searching && this.props.query && !this.state.results.length ? : null }
+ { !this.props.query && !this.state.searching ? : null }
);
}
diff --git a/scss/_canvas.scss b/scss/_canvas.scss
index 710f303a4..6c15ca4f0 100644
--- a/scss/_canvas.scss
+++ b/scss/_canvas.scss
@@ -68,6 +68,7 @@ $drawer-width: 240px;
{
#main-content { margin-left: $drawer-width; }
.open-drawer-link { visibility: hidden; }
+ #header { padding-left: $drawer-width + $spacing-vertical / 2; }
}
#header
@@ -75,18 +76,29 @@ $drawer-width: 240px;
background: $color-primary;
color: white;
height: $header-height;
- padding: $spacing-vertical / 2 $spacing-vertical / 2 $spacing-vertical / 2 $drawer-width + $spacing-vertical / 2;
+ padding: $spacing-vertical / 2;
position: fixed;
top: 0;
left: 0;
width: 100%;
box-sizing: border-box;
- h1 { font-size: 1.8em; line-height: $header-height - $spacing-vertical; display: inline-block; }
+ h1 { font-size: 1.8em; line-height: $header-height - $spacing-vertical; display: inline-block; float: left; }
&.header-scrolled
{
box-shadow: $default-box-shadow;
}
}
+.header-search
+{
+ margin-left: 60px;
+ text-align: center;
+ input[type="search"] {
+ background: rgba(255, 255, 255, 0.3);
+ color: white;
+ width: 400px;
+ @include placeholder-color(#e8e8e8);
+ }
+}
#main-content
{
@@ -97,6 +109,19 @@ $drawer-width: 240px;
margin-top: $header-height;
padding: $spacing-vertical;
}
+ h2
+ {
+ margin-bottom: $spacing-vertical;
+ }
+ h3, h4
+ {
+ margin-bottom: $spacing-vertical / 2;
+ margin-top: $spacing-vertical;
+ &:first-child
+ {
+ margin-top: 0;
+ }
+ }
}
$header-icon-size: 1.5em;
@@ -105,7 +130,7 @@ $header-icon-size: 1.5em;
{
display: inline-block;
font-size: $header-icon-size;
- padding: 0 18px 0 6px;
+ padding: 2px 6px 0 6px;
float: left;
}
.close-lbry-link
@@ -123,19 +148,7 @@ $header-icon-size: 1.5em;
background: $color-bg;
box-shadow: $default-box-shadow;
border-radius: 2px;
- h2
- {
- margin-bottom: $spacing-vertical;
- }
- h3, h4
- {
- margin-bottom: $spacing-vertical / 2;
- margin-top: $spacing-vertical;
- &:first-child
- {
- margin-top: 0;
- }
- }
+
}
.full-screen
diff --git a/scss/_global.scss b/scss/_global.scss
index 286645175..8bfde1b90 100644
--- a/scss/_global.scss
+++ b/scss/_global.scss
@@ -43,6 +43,22 @@ $default-box-shadow: 0 2px 2px 0 rgba(0,0,0,.14),0 3px 1px -2px rgba(0,0,0,.2),0
border-radius: $radius;
}
+@mixin placeholder-color($color) {
+ /*do not group these it breaks because CSS*/
+ &:-moz-placeholder {
+ color: $color;
+ }
+ &::-moz-placeholder {
+ color: $color;
+ }
+ &:-ms-input-placeholder {
+ color: $color;
+ }
+ &::-webkit-input-placeholder {
+ color: $color;
+ }
+}
+
@mixin display-flex()
{
display: -webkit-box;