Merge pull request #1587 from lbryio/css-fixes

CSS fixes
This commit is contained in:
Sean Yesmunt 2018-06-14 16:33:38 -04:00 committed by GitHub
commit ae93a0d95d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
23 changed files with 139 additions and 76 deletions

View file

@ -84,8 +84,8 @@ class App extends React.PureComponent<Props> {
<Theme /> <Theme />
<main className="page"> <main className="page">
<SideBar /> <SideBar />
<Header />
<div className="content" id="content"> <div className="content" id="content">
<Header />
<Router /> <Router />
<ModalRouter /> <ModalRouter />
</div> </div>

View file

@ -4,7 +4,7 @@ import ReactDOMServer from 'react-dom/server';
import classnames from 'classnames'; import classnames from 'classnames';
import MarkdownPreview from 'component/common/markdown-preview'; import MarkdownPreview from 'component/common/markdown-preview';
import SimpleMDE from 'react-simplemde-editor'; import SimpleMDE from 'react-simplemde-editor';
import "simplemde/dist/simplemde.min.css"; import 'simplemde/dist/simplemde.min.css';
type Props = { type Props = {
name: string, name: string,
@ -20,6 +20,7 @@ type Props = {
placeholder?: string | number, placeholder?: string | number,
children?: React.Node, children?: React.Node,
stretch?: boolean, stretch?: boolean,
affixClass?: string, // class applied to prefix/postfix label
}; };
export class FormField extends React.PureComponent<Props> { export class FormField extends React.PureComponent<Props> {
@ -35,6 +36,7 @@ export class FormField extends React.PureComponent<Props> {
type, type,
children, children,
stretch, stretch,
affixClass,
...inputProps ...inputProps
} = this.props; } = this.props;
@ -57,9 +59,9 @@ export class FormField extends React.PureComponent<Props> {
options={{ options={{
hideIcons: ['heading', 'image', 'fullscreen', 'side-by-side'], hideIcons: ['heading', 'image', 'fullscreen', 'side-by-side'],
previewRender(plainText) { previewRender(plainText) {
const preview = <MarkdownPreview content={plainText}/>; const preview = <MarkdownPreview content={plainText} />;
return ReactDOMServer.renderToString(preview); return ReactDOMServer.renderToString(preview);
} },
}} }}
/> />
</div> </div>
@ -92,22 +94,18 @@ export class FormField extends React.PureComponent<Props> {
})} })}
> >
{prefix && ( {prefix && (
<label htmlFor={name} className="form-field__prefix"> <label htmlFor={name} className={classnames('form-field__prefix', affixClass)}>
{prefix} {prefix}
</label> </label>
)} )}
{input} {input}
{postfix && ( {postfix && (
<label htmlFor={name} className="form-field__postfix"> <label htmlFor={name} className={classnames('form-field__postfix', affixClass)}>
{postfix} {postfix}
</label> </label>
)} )}
</div> </div>
{helper && ( {helper && <div className="form-field__help">{helper}</div>}
<label htmlFor={name} className="form-field__help">
{helper}
</label>
)}
</div> </div>
); );
} }

View file

@ -171,6 +171,7 @@ class FileList extends React.PureComponent<Props, State> {
{!hideFilter && ( {!hideFilter && (
<FormField <FormField
prefix={__('Sort by')} prefix={__('Sort by')}
affixClass="form-field--align-center"
type="select" type="select"
value={sortBy} value={sortBy}
onChange={this.handleSortChanged} onChange={this.handleSortChanged}

View file

@ -19,7 +19,10 @@ class LoadScreen extends React.PureComponent<Props> {
return ( return (
<div className="load-screen"> <div className="load-screen">
<div className="load-screen__header">
<h1 className="load-screen__title">{__('LBRY')}</h1> <h1 className="load-screen__title">{__('LBRY')}</h1>
<sup className="load-screen__beta">beta</sup>
</div>
{isWarning ? ( {isWarning ? (
<span className="load-screen__message"> <span className="load-screen__message">
<Icon size={20} icon={icons.ALERT} /> <Icon size={20} icon={icons.ALERT} />

View file

@ -96,6 +96,7 @@ class TransactionList extends React.PureComponent<Props, State> {
type="select" type="select"
value={filter} value={filter}
onChange={this.handleFilterChanged} onChange={this.handleFilterChanged}
affixClass="form-field--align-center"
prefix={__('Show')} prefix={__('Show')}
postfix={ postfix={
<Button <Button

View file

@ -56,8 +56,10 @@ class WalletSend extends React.PureComponent<Props> {
label={__('Amount')} label={__('Amount')}
postfix={__('LBC')} postfix={__('LBC')}
className="input--price-amount" className="input--price-amount"
affixClass="form-field--fix-no-height"
min="0" min="0"
step="any" step="any"
placeholder="12.34"
onChange={handleChange} onChange={handleChange}
onBlur={handleBlur} onBlur={handleBlur}
value={values.amount} value={values.amount}

View file

@ -87,7 +87,12 @@ class WalletSendTip extends React.PureComponent<Props, State> {
disabled={isPending || amount <= 0 || amount > balance} disabled={isPending || amount <= 0 || amount > balance}
onClick={this.handleSendButtonClicked} onClick={this.handleSendButtonClicked}
/> />
<Button button="alt" label={__('Cancel')} onClick={onCancel} navigateParams={{ uri }} /> <Button
button="link"
label={__('Cancel')}
onClick={onCancel}
navigateParams={{ uri }}
/>
</div> </div>
</div> </div>
</div> </div>

View file

@ -34,7 +34,7 @@ class ModalDownloading extends React.PureComponent {
/> />
) : null} ) : null}
<Button <Button
button="alt" button="link"
label={__('Cancel')} label={__('Cancel')}
className="modal__button" className="modal__button"
onClick={cancelUpgrade} onClick={cancelUpgrade}

View file

@ -1,13 +1,19 @@
import React from 'react';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { doHideNotification } from 'lbry-redux';
import { doDownloadUpgrade, doSkipUpgrade } from 'redux/actions/app'; import { doDownloadUpgrade, doSkipUpgrade } from 'redux/actions/app';
import ModalUpgrade from './view'; import ModalUpgrade from './view';
const select = state => ({}); const select = () => ({});
const perform = dispatch => ({ const perform = dispatch => ({
downloadUpgrade: () => dispatch(doDownloadUpgrade()), downloadUpgrade: () => dispatch(doDownloadUpgrade()),
skipUpgrade: () => dispatch(doSkipUpgrade()), skipUpgrade: () => {
dispatch(doHideNotification());
dispatch(doSkipUpgrade());
},
}); });
export default connect(select, perform)(ModalUpgrade); export default connect(
select,
perform
)(ModalUpgrade);

View file

@ -24,7 +24,11 @@ class ModalUpgrade extends React.PureComponent {
</p> </p>
<p className="meta text-center"> <p className="meta text-center">
{__('Want to know what has changed?')} See the{' '} {__('Want to know what has changed?')} See the{' '}
<Button label={__('release notes')} href="https://github.com/lbryio/lbry-app/releases" />. <Button
button="link"
label={__('release notes')}
href="https://github.com/lbryio/lbry-app/releases"
/>.
</p> </p>
</Modal> </Modal>
); );

View file

@ -20,6 +20,7 @@ import * as settings from 'constants/settings';
import type { Claim } from 'types/claim'; import type { Claim } from 'types/claim';
import type { Subscription } from 'types/subscription'; import type { Subscription } from 'types/subscription';
import FileDownloadLink from 'component/fileDownloadLink'; import FileDownloadLink from 'component/fileDownloadLink';
import classnames from 'classnames';
type Props = { type Props = {
claim: Claim, claim: Claim,
@ -114,8 +115,7 @@ class FilePage extends React.Component<Props> {
const shouldObscureThumbnail = obscureNsfw && metadata.nsfw; const shouldObscureThumbnail = obscureNsfw && metadata.nsfw;
const { height, channel_name: channelName, value } = claim; const { height, channel_name: channelName, value } = claim;
const mediaType = Lbry.getMediaType(contentType); const mediaType = Lbry.getMediaType(contentType);
const isPlayable = const isPlayable = Object.values(player.mime).includes(contentType) || mediaType === 'audio';
Object.values(player.mime).indexOf(contentType) !== -1 || mediaType === 'audio';
const channelClaimId = const channelClaimId =
value && value.publisherSignature && value.publisherSignature.certificateId; value && value.publisherSignature && value.publisherSignature.certificateId;
let subscriptionUri; let subscriptionUri;
@ -149,11 +149,19 @@ class FilePage extends React.Component<Props> {
</section> </section>
) : ( ) : (
<section className="card"> <section className="card">
{isPlayable ? ( {isPlayable && <Video className="content__embedded" uri={uri} />}
<Video className="content__embedded" uri={uri} /> {!isPlayable &&
) : ( (thumbnail ? (
<Thumbnail shouldObscure={shouldObscureThumbnail} src={thumbnail} /> <Thumbnail shouldObscure={shouldObscureThumbnail} src={thumbnail} />
)} ) : (
<div
className={classnames('content__empty', {
'content__empty--nsfw': shouldObscureThumbnail,
})}
>
<div className="card__media-text">{__('This content is not playable.')}</div>
</div>
))}
<div className="card__content"> <div className="card__content">
<div className="card__title-identity--file"> <div className="card__title-identity--file">
<h1 className="card__title card__title--file">{title}</h1> <h1 className="card__title card__title--file">{title}</h1>
@ -171,7 +179,6 @@ class FilePage extends React.Component<Props> {
{metadata.nsfw && <div>NSFW</div>} {metadata.nsfw && <div>NSFW</div>}
<div className="card__channel-info"> <div className="card__channel-info">
<UriIndicator uri={uri} link /> <UriIndicator uri={uri} link />
<div className="card__actions card__actions--no-margin"> <div className="card__actions card__actions--no-margin">
{claimIsMine ? ( {claimIsMine ? (
<Button <Button
@ -184,21 +191,26 @@ class FilePage extends React.Component<Props> {
}} }}
/> />
) : ( ) : (
<React.Fragment> <SubscribeButton uri={subscriptionUri} channelName={channelName} />
)}
</div>
</div>
{!claimIsMine ||
(speechSharable && (
<div className="card__actions card__actions--end">
{!claimIsMine && (
<Button <Button
button="alt" button="alt"
icon="Send" icon="Send"
label={__('Enjoy this? Send a tip')} label={__('Enjoy this? Send a tip')}
onClick={() => openModal({ id: MODALS.SEND_TIP }, { uri })} onClick={() => openModal({ id: MODALS.SEND_TIP }, { uri })}
/> />
<SubscribeButton uri={subscriptionUri} channelName={channelName} />
</React.Fragment>
)} )}
{speechSharable && ( {speechSharable && (
<ViewOnWebButton claimId={claim.claim_id} claimName={claim.name} /> <ViewOnWebButton claimId={claim.claim_id} claimName={claim.name} />
)} )}
</div> </div>
</div> ))}
<FormRow alignRight> <FormRow alignRight>
<FormField <FormField
type="checkbox" type="checkbox"

View file

@ -3,18 +3,11 @@ import Button from 'component/button';
import RewardSummary from 'component/rewardSummary'; import RewardSummary from 'component/rewardSummary';
import ShapeShift from 'component/shapeShift'; import ShapeShift from 'component/shapeShift';
import Page from 'component/page'; import Page from 'component/page';
import * as icons from 'constants/icons';
const GetCreditsPage = props => ( const GetCreditsPage = () => (
<Page> <Page>
<RewardSummary /> <RewardSummary />
<ShapeShift /> <ShapeShift />
<section className="card card--section">
<div className="card__title">{__('From External Wallet')}</div>
<div className="card__actions">
<Button button="primary" icon={icons.SEND} navigate="/send" label={__('Send / Receive')} />
</div>
</section>
<section className="card card--section"> <section className="card card--section">
<div className="card__title">{__('More ways to get LBRY Credits')}</div> <div className="card__title">{__('More ways to get LBRY Credits')}</div>
<div className="card__content"> <div className="card__content">

View file

@ -273,7 +273,6 @@ class SettingsPage extends React.PureComponent<Props, State> {
</section> </section>
<section className="card card--section"> <section className="card card--section">
<div className="card__title">{__('Share Diagnostic Data')}</div> <div className="card__title">{__('Share Diagnostic Data')}</div>
<div className="card__content">
<FormField <FormField
type="checkbox" type="checkbox"
name="share_usage_data" name="share_usage_data"
@ -286,7 +285,6 @@ class SettingsPage extends React.PureComponent<Props, State> {
'You will be ineligible to earn rewards while diagnostics are not being shared.' 'You will be ineligible to earn rewards while diagnostics are not being shared.'
)} )}
/> />
</div>
</section> </section>
{ {
<section className="card card--section"> <section className="card card--section">
@ -317,7 +315,7 @@ class SettingsPage extends React.PureComponent<Props, State> {
<section className="card card--section"> <section className="card card--section">
<div className="card__title">{__('Application Cache')}</div> <div className="card__title">{__('Application Cache')}</div>
<span className="card__subtitle"> <span className="card__subtitle">
{__("This will delete your subscriptions, and clear the app's cache")} {__('This will clear the application cache. Your wallet will not be affected.')}
</span> </span>
<div className="card__content"> <div className="card__content">
<Button <Button

View file

@ -10,6 +10,7 @@ import {
doNotify, doNotify,
selectNotification, selectNotification,
MODALS, MODALS,
doHideNotification,
} from 'lbry-redux'; } from 'lbry-redux';
import Native from 'native'; import Native from 'native';
import { doFetchRewardedContent } from 'redux/actions/content'; import { doFetchRewardedContent } from 'redux/actions/content';
@ -89,6 +90,7 @@ export function doDownloadUpgrade() {
dispatch({ dispatch({
type: ACTIONS.UPGRADE_DOWNLOAD_STARTED, type: ACTIONS.UPGRADE_DOWNLOAD_STARTED,
}); });
dispatch(doHideNotification());
dispatch( dispatch(
doNotify({ doNotify({
id: MODALS.DOWNLOADING, id: MODALS.DOWNLOADING,

View file

@ -278,7 +278,7 @@ export const doCheckPendingPublishes = () => (dispatch: Dispatch, getState: GetS
dispatch(batchActions(...actions)); dispatch(batchActions(...actions));
if (!pendingPublishes.length) { if (!Object.keys(pendingPublishes).length) {
clearInterval(publishCheckInterval); clearInterval(publishCheckInterval);
} }
}); });

View file

@ -114,7 +114,6 @@ reducers[ACTIONS.SKIP_UPGRADE] = state => {
return Object.assign({}, state, { return Object.assign({}, state, {
isUpgradeSkipped: true, isUpgradeSkipped: true,
modal: null,
}); });
}; };

View file

@ -121,6 +121,10 @@ input::placeholder {
opacity: 0.5; opacity: 0.5;
} }
label[for] {
cursor: pointer;
}
button + input { button + input {
margin-left: $spacing-vertical * 2/3; margin-left: $spacing-vertical * 2/3;
} }
@ -157,7 +161,7 @@ p {
grid-template-rows: var(--header-height) calc(100vh - var(--header-height)); grid-template-rows: var(--header-height) calc(100vh - var(--header-height));
grid-template-columns: var(--side-nav-width) auto; grid-template-columns: var(--side-nav-width) auto;
grid-template-areas: grid-template-areas:
'nav header' 'nav content'
'nav content'; 'nav content';
background-color: var(--color-bg); background-color: var(--color-bg);
height: 100vh; height: 100vh;
@ -176,7 +180,7 @@ p {
*/ */
.content { .content {
grid-area: content; grid-area: content;
overflow: auto; overflow-y: auto;
} }
.main { .main {

View file

@ -42,6 +42,7 @@ $large-breakpoint: 1760px;
--color-divider: #e3e3e3; --color-divider: #e3e3e3;
--color-help: rgba(0, 0, 0, 0.54); --color-help: rgba(0, 0, 0, 0.54);
--color-error: #a94442; --color-error: #a94442;
--color-nsfw: #bf4440;
--color-download: var(--color-white); --color-download: var(--color-white);
--color-download-overlay: var(--color-black); --color-download-overlay: var(--color-black);
--color-bg: #fafafa; --color-bg: #fafafa;

View file

@ -27,17 +27,17 @@
padding-top: var(--video-aspect-ratio); padding-top: var(--video-aspect-ratio);
} }
.card__media-text {
// for the weird padding required for dynamic height
// this lets the text sit in the middle instead of the bottom
margin-top: calc(var(--video-aspect-ratio) * -1);
}
.channel-name { .channel-name {
font-size: 12px; font-size: 12px;
} }
} }
.card__media-text {
// for the weird padding required for dynamic height
// this lets the text sit in the middle instead of the bottom
margin-top: calc(var(--video-aspect-ratio) * -1);
}
.card--link { .card--link {
cursor: pointer; cursor: pointer;
} }
@ -244,6 +244,10 @@
right: $spacing-vertical; right: $spacing-vertical;
} }
.card__actions--end {
justify-content: flex-end;
}
/* /*
.card-row is used on the discover page .card-row is used on the discover page
It is a list of cards that extend past the right edge of the screen It is a list of cards that extend past the right edge of the screen

View file

@ -78,6 +78,20 @@
color: var(--color-white); color: var(--color-white);
} }
.content__empty {
background-color: black;
width: 100%;
padding-top: var(--video-aspect-ratio);
display: flex;
align-items: center;
justify-content: center;
color: var(--color-white);
&.content__empty--nsfw {
background-color: var(--color-nsfw);
}
}
img { img {
max-height: 100%; max-height: 100%;
max-width: 100%; max-width: 100%;

View file

@ -84,7 +84,7 @@
.form-field__help { .form-field__help {
color: var(--color-help); color: var(--color-help);
padding-top: $spacing-vertical * 1/3; padding-top: $spacing-vertical * 2/3;
} }
.form-field__error { .form-field__error {
@ -94,6 +94,14 @@
.form-field__prefix, .form-field__prefix,
.form-field__postfix { .form-field__postfix {
font-family: 'metropolis-medium'; font-family: 'metropolis-medium';
&.form-field--fix-no-height {
line-height: 1;
}
&.form-field--align-center {
align-self: center;
}
} }
.form-field__prefix { .form-field__prefix {

View file

@ -1,11 +1,9 @@
.header { .header {
grid-area: header;
display: flex; display: flex;
z-index: 1; z-index: 1;
justify-content: space-between; justify-content: space-between;
padding: $spacing-width $spacing-width 0 $spacing-width; padding: $spacing-width $spacing-width 0 $spacing-width;
background-color: var(--color-bg); background-color: var(--color-bg);
// height: 100px;
} }
.header__actions-right { .header__actions-right {

View file

@ -10,10 +10,20 @@
justify-content: center; justify-content: center;
} }
.load-screen__header {
display: flex;
}
.load-screen__title { .load-screen__title {
font-family: 'metropolis-bold'; font-family: 'metropolis-bold';
font-size: 60px; font-size: 60px;
line-height: 100px; line-height: 100px;
margin-left: 40px; // width of "beta" superscript
}
.load-screen__beta {
padding-top: 23px;
padding-left: 10px;
} }
.load-screen__message { .load-screen__message {