Moved common-prop-types out of src/ folder (#7871)
This commit is contained in:
parent
26cf4085fc
commit
be5f80a04b
35 changed files with 40 additions and 38 deletions
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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 (
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
);
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
/>
|
||||
|
|
|
|||
|
|
@ -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">
|
||||
|
|
|
|||
|
|
@ -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 }) => {
|
||||
|
|
|
|||
|
|
@ -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 }) => {
|
||||
|
|
|
|||
|
|
@ -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() {
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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}
|
||||
|
|
|
|||
|
|
@ -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}
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
|
|||
|
|
@ -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 (
|
||||
|
|
|
|||
|
|
@ -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 = '';
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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';
|
||||
|
||||
|
|
|
|||
|
|
@ -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 (
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -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 (
|
||||
|
|
|
|||
|
|
@ -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's Podcasts</a></h3>
|
||||
<div className="crayons-story__body">
|
||||
<h3 className="crayons-story__headline">
|
||||
<a href="/pod">Today's Podcasts</a>
|
||||
</h3>
|
||||
{children}
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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">
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue