Browse Source

Fix formatting

pull/1/head
GreatBearShark 1 year ago
parent
commit
62d2787402
  1. 24
      src/components/MenuButton.tsx
  2. 8
      src/components/ThemeSystemProvider.tsx
  3. 6
      src/components/comment-form.tsx
  4. 4
      src/components/data-type-select.tsx
  5. 4
      src/components/iframely-card.tsx
  6. 4
      src/components/listing-type-select.tsx
  7. 8
      src/components/post-listing.tsx
  8. 12
      src/components/sample.tsx
  9. 2
      src/custom.css
  10. 6
      src/hooks/useInterval.tsx
  11. 2
      src/index.tsx
  12. 4
      src/isProduction.ts
  13. 2
      src/linkEvent.ts
  14. 6
      src/normalize-url.ts
  15. 12
      src/stories/MenuButton.stories.tsx
  16. 2
      src/version.ts

24
src/components/MenuButton.tsx

@ -8,12 +8,24 @@ import {
MenuItems as ReachMenuItems,
MenuPopover as ReachMenuPopover,
MenuLink as ReachMenuLink,
} from "@reach/menu-button";
import "@reach/menu-button/styles.css";
} from '@reach/menu-button';
import '@reach/menu-button/styles.css';
import { Box, Button, Flex } from 'theme-ui';
export const Menu = props => <Box as={ReachMenu} {...props} />
export const MenuButton = props => <Button as={ReachMenuButton} {...props} />
export const MenuList = props => <Box bg="muted" css={{ borderRadius: '4px' }} color="text" mt={1} py={2} as={ReachMenuList} {...props} />
export const Menu = props => <Box as={ReachMenu} {...props} />;
export const MenuButton = props => <Button as={ReachMenuButton} {...props} />;
export const MenuList = props => (
<Box
bg="muted"
css={{ borderRadius: '4px' }}
color="text"
mt={1}
py={2}
as={ReachMenuList}
{...props}
/>
);
export const MenuItem = props => <Flex px={3} css={{ alignItems: 'center' }} as={ReachMenuItem} {...props} />
export const MenuItem = props => (
<Flex px={3} css={{ alignItems: 'center' }} as={ReachMenuItem} {...props} />
);

8
src/components/ThemeSystemProvider.tsx

@ -10,7 +10,13 @@ interface ThemeSystemState {
const ThemeSystem = createContext({} as ThemeSystemState);
function ThemeSystemProvider({ children, initialTheme = 'chapo' }: { children: React.ReactNode,initialTheme?: string }) {
function ThemeSystemProvider({
children,
initialTheme = 'chapo',
}: {
children: React.ReactNode;
initialTheme?: string;
}) {
const [currentTheme, setCurrentTheme] = useState(initialTheme);
const theme = Object.keys(themes).includes(currentTheme)

6
src/components/comment-form.tsx

@ -68,7 +68,7 @@ export class CommentForm extends Component<CommentFormProps, CommentFormState> {
componentDidMount() {
if (this.props.node) {
if (this.props.edit) {
const commentForm: any = {}
const commentForm: any = {};
commentForm.edit_id = this.props.node.comment.id;
commentForm.parent_id = this.props.node.comment.parent_id;
commentForm.content = this.props.node.comment.content;
@ -77,8 +77,8 @@ export class CommentForm extends Component<CommentFormProps, CommentFormState> {
commentForm: {
...this.state.commentForm,
...commentForm,
}
})
},
});
} else {
// A reply gets a new parent id
this.state.commentForm.parent_id = this.props.node.comment.id;

4
src/components/data-type-select.tsx

@ -51,9 +51,7 @@ export class DataTypeSelect extends Component<
</Button>
<Button
as="label"
variant={
this.state.type_ == DataType.Comment ? 'primary' : 'muted'
}
variant={this.state.type_ == DataType.Comment ? 'primary' : 'muted'}
>
<input
type="radio"

4
src/components/iframely-card.tsx

@ -104,7 +104,7 @@ export class IFramelyCard extends Component<
handleIframeExpand = () => {
this.setState({
expanded: !this.state.expanded
expanded: !this.state.expanded,
});
}
};
}

4
src/components/listing-type-select.tsx

@ -56,9 +56,7 @@ export class ListingTypeSelect extends Component<
</Button>
<Button
as="label"
variant={
this.state.type_ == ListingType.All ? 'primary' : 'muted'
}
variant={this.state.type_ == ListingType.All ? 'primary' : 'muted'}
>
<input
type="radio"

8
src/components/post-listing.tsx

@ -721,7 +721,12 @@ export class BasePostListing extends Component<
className="post-body-expand-button post-listing-box"
title={i18n.t('expand_here')}
color="text"
bg="primary"
bg="background"
css={{
'&:hover': {
bg: 'var(--theme-ui-colors-background,#A4288B)',
},
}}
// onClick={() =>
// !this.props.showBody && linkEvent(this, this.handleImageExpandClick)
// }
@ -1067,6 +1072,7 @@ export class BasePostListing extends Component<
color: '#000',
},
}}
// @ts-ignore
href={post.url}
target="_blank"
title={post.url}

12
src/components/sample.tsx

@ -3,10 +3,12 @@ import React from 'react';
function Sample() {
return (
<div>
<div style={{
display: "inline-block",
marginTop: "6px"
}}>
<div
style={{
display: 'inline-block',
marginTop: '6px',
}}
>
Incorrect format
</div>
@ -15,4 +17,4 @@ function Sample() {
</div>
</div>
);
}
}

2
src/custom.css

@ -155,7 +155,7 @@ a.text-body {
}
.post-body-expand-button {
background-color: transparent;
background-color: transparent !important;
border: 0;
box-shadow: 0;
width: 100%;

6
src/hooks/useInterval.tsx

@ -1,6 +1,6 @@
import { useEffect, useRef } from 'react';
// eslint-ignore-next-line
// eslint-disable-next-line @typescript-eslint/no-empty-function
const noop = () => {};
/**
@ -23,7 +23,7 @@ export function useInterval(
if (!immediate) return;
if (delay === null || delay === false) return;
savedCallback.current();
}, [immediate]);
}, [immediate, delay]);
// Set up the interval.
useEffect(() => {
@ -32,4 +32,4 @@ export function useInterval(
const id = setInterval(tick, delay);
return () => clearInterval(id);
}, [delay]);
}
}

2
src/index.tsx

@ -134,10 +134,8 @@ class Index extends Component<any, any> {
}
}
// eslint-disable-next-line no-undef
if (process.env.NODE_ENV !== 'development') {
// @ts-ignore
// eslint-disable-next-line no-undef
Sentry.init({
dsn:
'https://[email protected]/5336831',

4
src/isProduction.ts

@ -1,4 +1,4 @@
// eslint-ignore-next-line
export const isProduction = process.env.NODE_ENV === "production";
export const isProduction = process.env.NODE_ENV === 'production';
export const BASE_PATH = isProduction ? "/static/" : "/";
export const BASE_PATH = isProduction ? '/static/' : '/';

2
src/linkEvent.ts

@ -2,6 +2,8 @@
// helpers from inferno-shared
// https://github.com/infernojs/inferno/blob/master/packages/inferno-shared/src/index.ts
// @ts-ignore
// eslint-disable-next-line @typescript-eslint/ban-types
export function isFunction(o: any): o is Function {
return typeof o === 'function';
}

6
src/normalize-url.ts

@ -143,7 +143,7 @@ const normalizeUrl = (urlString: string, options?: any) => {
if (urlObj.pathname) {
try {
urlObj.pathname = decodeURI(urlObj.pathname);
} catch {}
} catch {}
}
// Remove directory index
@ -171,9 +171,7 @@ const normalizeUrl = (urlString: string, options?: any) => {
// Remove `www.`
if (
options.stripWWW &&
/^www\.(?!www\.)[\da-z\-]{1,63}\.[\d.a-z\-]{2,63}$/.test(
urlObj.hostname
)
/^www\.(?!www\.)[\da-z\-]{1,63}\.[\d.a-z\-]{2,63}$/.test(urlObj.hostname)
) {
// Each label should be max 63 at length (min: 1).
// Source: https://en.wikipedia.org/wiki/Hostname#Restrictions_on_valid_host_names

12
src/stories/MenuButton.stories.tsx

@ -6,9 +6,9 @@ import {
// MenuItem,
MenuItems,
MenuPopover,
MenuLink
} from "@reach/menu-button";
import "@reach/menu-button/styles.css";
MenuLink,
} from '@reach/menu-button';
import '@reach/menu-button/styles.css';
import { Menu, MenuButton, MenuItem, MenuList } from '../components/MenuButton';
import { ThemeSystemProvider } from '../components/ThemeSystemProvider';
import { Icon } from '../components/icon';
@ -20,9 +20,11 @@ export const Basic = () => (
<Menu>
<MenuButton>Actions</MenuButton>
<MenuList>
<MenuItem><Icon name="report" /> Report</MenuItem>
<MenuItem>
<Icon name="report" /> Report
</MenuItem>
<MenuLink to="view">View</MenuLink>
</MenuList>
</Menu>
</ThemeSystemProvider>
)
);

2
src/version.ts

@ -1 +1 @@
export const version: string = 'v0.7.25';
export const version = 'v0.7.25';
Loading…
Cancel
Save