Skip to content
This repository has been archived by the owner on Jan 28, 2023. It is now read-only.

Commit

Permalink
cleanup, add selection color
Browse files Browse the repository at this point in the history
  • Loading branch information
PzYon committed Aug 3, 2018
1 parent 3066195 commit 439015f
Show file tree
Hide file tree
Showing 16 changed files with 83 additions and 96 deletions.
2 changes: 1 addition & 1 deletion client/src/authentication/AuthStore.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { IUser } from "engraved-shared";
import { BehaviorSubject } from "rxjs/index";
import { BehaviorSubject } from "rxjs";
import { LocalStorageUtil } from "../common/storage/LocalStorageUtil";

export class AuthStore {
Expand Down
16 changes: 7 additions & 9 deletions client/src/common/Keywords.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,13 @@ export const Keywords: React.SFC<IKeywordsProps> = (props: IKeywordsProps) => {
return (
<If
value={props.keywords}
render={() => {
return (
<Container className={"ngrvd-keywords"}>
{props.keywords.map(k => (
<Keyword key={k._id || k.name} keyword={k} onClick={props.onClick} />
))}
</Container>
);
}}
render={() => (
<Container className={"ngrvd-keywords"}>
{props.keywords.map(k => (
<Keyword key={k._id || k.name} keyword={k} onClick={props.onClick} />
))}
</Container>
)}
/>
);
};
2 changes: 1 addition & 1 deletion client/src/common/WelcomeScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export const WelcomeScreen: React.SFC<{}> = () => {
<TitleDiv>engraved.</TitleDiv>
<MessageDiv>
<a href={AuthenticatedServerApi.authUrl}>Login</a> or{" "}
<a href={AuthenticatedServerApi.authUrl}>signup</a> using your google account.
<a href={AuthenticatedServerApi.authUrl}>sign up</a> using your google account.
</MessageDiv>
</InnerDiv>
</RootDiv>
Expand Down
1 change: 0 additions & 1 deletion client/src/common/form/Form.StyledComponents.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { ReactNode } from "react";
import * as React from "react";
import styled from "styled-components";
import { StyleConstants } from "../../styling/StyleConstants";
Expand Down
14 changes: 6 additions & 8 deletions client/src/common/form/fields/FieldWrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,11 @@ export interface IFieldWrapperProps {
export const FieldWrapper: React.SFC<IFieldWrapperProps> = (props: IFieldWrapperProps) => (
<If
value={props.doRender}
render={() => {
return (
<FormLabel>
<FormLabelSpan>{props.label}</FormLabelSpan>
<FormFieldSpan>{props.children}</FormFieldSpan>
</FormLabel>
);
}}
render={() => (
<FormLabel>
<FormLabelSpan>{props.label}</FormLabelSpan>
<FormFieldSpan>{props.children}</FormFieldSpan>
</FormLabel>
)}
/>
);
2 changes: 1 addition & 1 deletion client/src/common/form/fields/Markdown.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as MarkdownIt from "markdown-it";
import { ReactNode } from "react";
import * as React from "react";
import { ReactNode } from "react";
import styled from "styled-components";
import { StyleConstants } from "../../../styling/StyleConstants";
import { StyleUtil } from "../../../styling/StyleUtil";
Expand Down
32 changes: 13 additions & 19 deletions client/src/common/form/fields/MarkdownField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,29 +38,23 @@ export class MarkdownField extends React.PureComponent<IMarkdownFieldProps, IMar
>
<If
value={!this.props.isReadOnly}
render={() => {
return (
<TogglePreviewSpan
onClick={() => this.setState({ isPreview: !this.state.isPreview })}
>
{this.state.isPreview ? "Back to edit mode" : "View preview"}
</TogglePreviewSpan>
);
}}
render={() => (
<TogglePreviewSpan onClick={() => this.setState({ isPreview: !this.state.isPreview })}>
{this.state.isPreview ? "Back to edit mode" : "View preview"}
</TogglePreviewSpan>
)}
/>
<If
value={this.props.isReadOnly || this.state.isPreview}
render={() => <Markdown markdown={this.props.value} />}
renderElse={() => {
return (
<CodeEditor
language={CodeLanguage.Markdown}
onValueChange={this.props.onValueChange}
value={this.props.value}
isReadOnly={false}
/>
);
}}
renderElse={() => (
<CodeEditor
language={CodeLanguage.Markdown}
onValueChange={this.props.onValueChange}
value={this.props.value}
isReadOnly={false}
/>
)}
/>
</FieldWrapper>
);
Expand Down
2 changes: 0 additions & 2 deletions client/src/common/searchBox/SelectedKeywords.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@ import * as React from "react";
import { Simulate } from "react-dom/test-utils";
import styled from "styled-components";
import { StyleConstants } from "../../styling/StyleConstants";
import { Keyword } from "../Keyword";
import { Keywords } from "../Keywords";
import keyDown = Simulate.keyDown;

const ContainerDiv = styled.div`
padding: ${StyleConstants.formElementPadding};
Expand Down
5 changes: 5 additions & 0 deletions client/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ import { StyleConstants } from "./styling/StyleConstants";

const injectGlobalStyles = (): void => {
return injectGlobal`
::selection {
color: white;
background: ${StyleConstants.colors.accent};
}
body,
html,
input,
Expand Down
2 changes: 1 addition & 1 deletion client/src/items/IItemKindRegistration.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { IItem, ItemKind, IUrlItem } from "engraved-shared";
import { IItem, ItemKind } from "engraved-shared";
import { ReactNode } from "react";

export interface IItemKindRegistration<TItemKind extends IItem = IItem> {
Expand Down
60 changes: 30 additions & 30 deletions client/src/items/url/ViewUrlItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,27 @@ import { ItemKind, IUrlItem } from "engraved-shared";
import * as React from "react";
import { ReactNode } from "react";
import styled from "styled-components";
import { If } from "../../common/If";
import { ItemKindIcon } from "../../common/ItemKindIcon";
import { StyleConstants } from "../../styling/StyleConstants";
import { StyleUtil } from "../../styling/StyleUtil";
import { IViewItemProps } from "../IViewItemProps";

const IconAnchor = styled.a`
position: absolute;
background-color: ${StyleConstants.colors.ultraDiscreet};
color: ${StyleConstants.colors.accent};
height: 1.5rem;
left: 0.25rem;
top: 0.25rem;
opacity: 0;
transition: opacity 0.8s;
font-size: 0.7rem;
text-decoration: none;
display: flex;
align-items: center;
`;

const UrlInputDiv = styled.div`
position: relative;
`;
Expand All @@ -20,25 +36,10 @@ const UrlInput = styled.input`
max-width: calc(100% - 2.3rem - 2px) !important;
`;

const IconAnchor = styled.a`
position: absolute;
background-color: ${StyleConstants.colors.ultraDiscreet};
height: 1.5rem;
left: 0.25rem;
top: 0.25rem;
opacity: 0;
transition: opacity 0.8s;
`;

const IconImage = styled.img`
height: 1.5rem;
`;

const FallbackIconSpan = styled.span`
font-size: 1.4rem;
color: ${StyleConstants.colors.discreet};
`;

const ActionDiv = styled.div`
${StyleUtil.normalizeAnchors(StyleConstants.colors.accent)};
font-size: ${StyleConstants.font.small};
Expand Down Expand Up @@ -75,21 +76,20 @@ export class ViewUrlItem extends React.PureComponent<IViewItemProps<IUrlItem>, I
href={this.props.item.url}
target="_blank"
>
{!this.state.showFallbackIcon && (
<IconImage
src={this.getFaviconUrl()}
onLoad={() => (this.imageAnchorEl.style.opacity = "1")}
onError={() => {
this.setState({ showFallbackIcon: true });
this.imageAnchorEl.style.opacity = "1";
}}
/>
)}
{this.state.showFallbackIcon && (
<FallbackIconSpan>
<ItemKindIcon itemKind={ItemKind.Url} />
</FallbackIconSpan>
)}
<If
value={!this.state.showFallbackIcon}
render={() => (
<IconImage
src={this.getFaviconUrl()}
onLoad={() => (this.imageAnchorEl.style.opacity = "1")}
onError={() => {
this.setState({ showFallbackIcon: true });
this.imageAnchorEl.style.opacity = "1";
}}
/>
)}
renderElse={() => <ItemKindIcon itemKind={ItemKind.Url} />}
/>
</IconAnchor>
</UrlInputDiv>
<ActionDiv>
Expand Down
2 changes: 1 addition & 1 deletion client/src/notifications/NotificationStore.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { BehaviorSubject } from "rxjs/index";
import { BehaviorSubject } from "rxjs";
import { INotification } from "./INotification";

export class NotificationStore {
Expand Down
15 changes: 6 additions & 9 deletions client/src/pages/notFound/NotFoundPage.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
import { IItem, IUser, Util } from "engraved-shared";
import * as React from "react";
import { Page } from "../Page";

export const NotFoundPage: React.SFC = () => {
return (
<Page browserTitle={"Oh boy..."} title={"Oh boy..."}>
What you're looking for doesn't seem to exist. Either you f*cked up or the developer. Normally
it's the developer...
</Page>
);
};
export const NotFoundPage: React.SFC = () => (
<Page browserTitle={"Oh boy..."} title={"Oh boy..."}>
What you're looking for doesn't seem to exist. Either you f*cked up or the developer. Normally
it's the developer...
</Page>
);
2 changes: 1 addition & 1 deletion client/src/pages/search/GlobalSearchBox.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { IKeyword, ItemKind, Util } from "engraved-shared";
import { IKeyword, ItemKind } from "engraved-shared";
import * as React from "react";
import { ReactNode } from "react";
import styled, { css } from "styled-components";
Expand Down
20 changes: 9 additions & 11 deletions client/src/pages/search/results/ItemsList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,17 +48,15 @@ export class ItemsList extends React.PureComponent<{}, IListOfItemsState> {
return (
<If
value={this.state.items}
render={() => {
return (
<List>
{this.state.items.map((item: IItem) => (
<ListItem key={item._id}>
<Item item={item} />
</ListItem>
))}
</List>
);
}}
render={() => (
<List>
{this.state.items.map((item: IItem) => (
<ListItem key={item._id}>
<Item item={item} />
</ListItem>
))}
</List>
)}
/>
);
}
Expand Down
2 changes: 1 addition & 1 deletion client/src/pages/user/UserPage.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { IItem, IUser, Util } from "engraved-shared";
import { IUser } from "engraved-shared";
import * as moment from "moment";
import * as React from "react";
import { ReactNode } from "react";
Expand Down

0 comments on commit 439015f

Please sign in to comment.