Moved common-prop-types out of src/ folder (#7871)

This commit is contained in:
Nick Taylor 2020-05-14 16:58:29 -04:00 committed by GitHub
parent 26cf4085fc
commit be5f80a04b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
35 changed files with 40 additions and 38 deletions

View file

@ -1,7 +1,7 @@
import { h } from 'preact';
import PropTypes from 'prop-types';
import { Button } from '@crayons';
import { defaultChildrenPropTypes } from '../src/components/common-prop-types';
import { defaultChildrenPropTypes } from '../common-prop-types';
export const snackbarItemProps = {
children: defaultChildrenPropTypes.isRequired,

View file

@ -1,6 +1,6 @@
import { h } from 'preact';
import PropTypes from 'prop-types';
import { articlePropTypes } from '../src/components/common-prop-types/article-prop-types';
import { articlePropTypes } from '../common-prop-types/article-prop-types';
import {
ArticleCoverImage,
CommentsCount,

View file

@ -1,5 +1,5 @@
import { h } from 'preact';
import { articlePropTypes } from '../src/components/common-prop-types/article-prop-types';
import { articlePropTypes } from '../common-prop-types/article-prop-types';
export const PodcastArticle = ({ article }) => {
return (

View file

@ -1,5 +1,5 @@
import { h } from 'preact';
import { defaultChildrenPropTypes } from '../../src/components/common-prop-types';
import { defaultChildrenPropTypes } from '../../common-prop-types';
const ArticleWrapper = ({ children }) => (
<div className="articles-list">{children}</div>
@ -9,6 +9,6 @@ ArticleWrapper.propTypes = {
};
ArticleWrapper.displayName = 'ArticleWrapper';
export const articleDecorator = getStory => (
export const articleDecorator = (getStory) => (
<ArticleWrapper>{getStory()}</ArticleWrapper>
);

View file

@ -1,5 +1,5 @@
import { h } from 'preact';
import { articlePropTypes } from '../../src/components/common-prop-types';
import { articlePropTypes } from '../../common-prop-types';
export const ArticleCoverImage = ({ article }) => {
return (
@ -9,7 +9,7 @@ export const ArticleCoverImage = ({ article }) => {
title={article.title}
>
<div
style={{backgroundImage: `url(${article.main_image})`}}
style={{ backgroundImage: `url(${article.main_image})` }}
className="crayons-story__cover__image"
loading="lazy"
/>

View file

@ -1,5 +1,5 @@
import { h } from 'preact';
import { articlePropTypes } from '../../src/components/common-prop-types';
import { articlePropTypes } from '../../common-prop-types';
export const ContentTitle = ({ article }) => (
<h2 className="crayons-story__title">

View file

@ -2,7 +2,7 @@ import { h } from 'preact';
import {
articlePropTypes,
organizationPropType,
} from '../../src/components/common-prop-types';
} from '../../common-prop-types';
import { PublishDate } from './PublishDate';
export const Meta = ({ article, organization }) => {

View file

@ -1,5 +1,5 @@
import { h } from 'preact';
import { articlePropTypes } from '../../src/components/common-prop-types';
import { articlePropTypes } from '../../common-prop-types';
import { Button } from '../../crayons/Button';
export const ReactionsCount = ({ article }) => {

View file

@ -1,6 +1,6 @@
import { h, Component } from 'preact';
import PropTypes from 'prop-types';
import { articlePropTypes } from '../../src/components/common-prop-types';
import { articlePropTypes } from '../../common-prop-types';
export class SaveButton extends Component {
componentDidMount() {

View file

@ -1,5 +1,5 @@
import { h } from 'preact';
import { articleSnippetResultPropTypes } from '../../src/components/common-prop-types';
import { articleSnippetResultPropTypes } from '../../common-prop-types';
export const SearchSnippet = ({ highlightText }) => {
if (highlightText && highlightText.body_text.length > 0) {

View file

@ -1,9 +1,9 @@
import { h } from 'preact';
import { tagPropTypes } from '../../src/components/common-prop-types';
import { tagPropTypes } from '../../common-prop-types';
export const TagList = ({ tags = [] }) => (
<div className="crayons-story__tags">
{tags.map(tag => (
{tags.map((tag) => (
<a className="crayons-tag" href={`/t/${tag}`}>
<span className="crayons-tag__prefix">#</span>
{tag}

View file

@ -1,7 +1,7 @@
import { h } from 'preact';
import { articlePropTypes } from '../../src/components/common-prop-types';
import { articlePropTypes } from '../../common-prop-types';
export const Video = ({article}) => {
export const Video = ({ article }) => {
return (
<a
href={article.path}

View file

@ -1,6 +1,6 @@
import { h } from 'preact';
import PropTypes from 'prop-types';
import { defaultChildrenPropTypes } from '../../src/components/common-prop-types';
import { defaultChildrenPropTypes } from '../../common-prop-types';
function getAdditionalClassNames({
variant,

View file

@ -1,5 +1,5 @@
import { h } from 'preact';
import { defaultChildrenPropTypes } from '../../src/components/common-prop-types';
import { defaultChildrenPropTypes } from '../../common-prop-types';
export const ButtonGroup = ({ children }) => (
<div className="crayons-btn-group">{children}</div>

View file

@ -1,6 +1,6 @@
import { h } from 'preact';
import PropTypes from 'prop-types';
import { defaultChildrenPropTypes } from '../../src/components/common-prop-types/default-children-prop-types';
import { defaultChildrenPropTypes } from '../../common-prop-types/default-children-prop-types';
export const Dropdown = ({ children, className }) => {
return (

View file

@ -1,7 +1,7 @@
import { h, Component } from 'preact';
import PropTypes from 'prop-types';
import { Button } from '@crayons';
import { defaultChildrenPropTypes } from '../../src/components/common-prop-types';
import { defaultChildrenPropTypes } from '../../common-prop-types';
function getAdditionalClassNames({ size, className }) {
let additionalClassNames = '';

View file

@ -1,6 +1,6 @@
import { h } from 'preact';
import PropTypes from 'prop-types';
import { defaultChildrenPropTypes } from '../../../src/components/common-prop-types';
import { defaultChildrenPropTypes } from '../../../common-prop-types';
// Only radio and checkboxes require an additional CSS class (variant class). Other form elements do not.

View file

@ -1,5 +1,5 @@
import { h } from 'preact';
import { defaultChildrenPropTypes } from '../../src/components/common-prop-types';
import { defaultChildrenPropTypes } from '../../common-prop-types';
export const Fieldset = ({ children }) => (
<fieldset style={{ border: 'none' }}>{children}</fieldset>

View file

@ -1,12 +1,12 @@
import { h } from 'preact';
import PropTypes from 'prop-types';
import { tagPropTypes } from '../src/components/common-prop-types';
import { tagPropTypes } from '../common-prop-types';
export const TagsFollowed = ({ tags = [] }) => {
// TODO: Once we're using Preact X >, we can replace the containing <div /> with a Fragment, <></>
return (
<div id="followed-tags-wrapper">
{tags.map(tag => (
{tags.map((tag) => (
<div
key={tag.id}
className="sidebar-nav-element"

View file

@ -1,8 +1,8 @@
import { h } from 'preact';
import PropTypes from 'prop-types';
import ClassifiedFiltersCategories from "./ClassifiedFiltersCategories";
import ClassifiedFiltersTags from "./ClassifiedFiltersTags";
import { tagPropTypes } from '../../src/components/common-prop-types';
import ClassifiedFiltersCategories from './ClassifiedFiltersCategories';
import ClassifiedFiltersTags from './ClassifiedFiltersTags';
import { tagPropTypes } from '../../common-prop-types';
const ClassifiedFilters = ({
categories,

View file

@ -1,6 +1,6 @@
import { h } from 'preact';
import PropTypes from 'prop-types';
import { tagPropTypes } from '../../src/components/common-prop-types';
import { tagPropTypes } from '../../common-prop-types';
import ClearQueryButton from './ClearQueryButton';
import SelectedTags from './SelectedTags';

View file

@ -1,5 +1,5 @@
import { h } from 'preact';
import { selectedTagsPropTypes } from '../../src/components/common-prop-types';
import { selectedTagsPropTypes } from '../../common-prop-types';
const SelectedTags = ({ tags, onClick, onKeyPress }) => {
return (

View file

@ -1,9 +1,9 @@
import { h } from 'preact';
import PropTypes from 'prop-types';
import { organizationPropType } from '../src/components/common-prop-types';
import { organizationPropType } from '../common-prop-types';
const orgOptions = (organizations, organizationId) => {
const orgs = organizations.map(organization => {
const orgs = organizations.map((organization) => {
if (organizationId === organization.id) {
return (
<option value={organization.id} selected>

View file

@ -3,7 +3,7 @@ import PropTypes from 'prop-types';
import { Article, LoadingArticle } from '../articles';
import { Feed } from '../articles/Feed';
import { TodaysPodcasts, PodcastEpisode } from '../podcasts';
import { articlePropTypes } from '../src/components/common-prop-types';
import { articlePropTypes } from '../common-prop-types';
/**
* Sends analytics about the featured article.

View file

@ -1,5 +1,5 @@
import { h } from 'preact';
import { articlePropTypes } from '../src/components/common-prop-types';
import { articlePropTypes } from '../common-prop-types';
export const PodcastEpisode = ({ episode }) => {
return (

View file

@ -1,10 +1,12 @@
import { h } from 'preact';
import { defaultChildrenPropTypes } from '../src/components/common-prop-types';
import { defaultChildrenPropTypes } from '../common-prop-types';
export const TodaysPodcasts = ({ children }) => (
<div className="crayons-story">
<div class="crayons-story__body">
<h3 class="crayons-story__headline"><a href="/pod">Today&apos;s Podcasts</a></h3>
<div className="crayons-story__body">
<h3 className="crayons-story__headline">
<a href="/pod">Today&apos;s Podcasts</a>
</h3>
{children}
</div>
</div>

View file

@ -1,6 +1,6 @@
import { h, Component } from 'preact';
import PropTypes from 'prop-types';
import { userPropTypes } from '../src/components/common-prop-types';
import { userPropTypes } from '../common-prop-types';
class SidebarUser extends Component {
constructor(props) {

View file

@ -1,5 +1,5 @@
import { h } from 'preact';
import { defaultChildrenPropTypes } from '../common-prop-types';
import { defaultChildrenPropTypes } from '../../../common-prop-types';
const GlobalModalWrapper = ({ children }) => (
<div className="global-modal">