Skip to content

Commit

Permalink
Extract a list-items shared component #3229
Browse files Browse the repository at this point in the history
  • Loading branch information
davidcmoulton committed May 8, 2024
1 parent b564c9d commit b668174
Show file tree
Hide file tree
Showing 23 changed files with 23 additions and 22 deletions.
@@ -1,8 +1,8 @@
import * as RA from 'fp-ts/ReadonlyArray';
import { pipe } from 'fp-ts/function';
import { renderListItems } from '../../../../../shared-components/render-list-items';
import { HtmlFragment, toHtmlFragment } from '../../../../../types/html-fragment';
import { ListCardViewModel, renderListCard } from '../../../shared-components/list-card';
import { renderListItems } from '../../../shared-components/list-items';
import { renderListOfCards } from '../../../shared-components/list-of-cards';

export const renderFeaturedListsSection = (listCards: ReadonlyArray<ListCardViewModel>): HtmlFragment => pipe(
Expand Down
@@ -1,9 +1,9 @@
import * as E from 'fp-ts/Either';
import * as RA from 'fp-ts/ReadonlyArray';
import { pipe } from 'fp-ts/function';
import { renderListItems } from '../../../../../shared-components/render-list-items';
import { HtmlFragment, toHtmlFragment } from '../../../../../types/html-fragment';
import { renderArticleList } from '../../../shared-components/article-list';
import { renderListItems } from '../../../shared-components/list-items';
import { PaginationControlsViewModel, renderPaginationControls } from '../../../shared-components/pagination';
import { renderPaperActivitySummaryCard } from '../../../shared-components/paper-activity-summary-card';
import { renderErrorAsHtml } from '../../../shared-components/paper-activity-summary-card/render-error-as-html';
Expand Down
@@ -1,8 +1,8 @@
import * as RA from 'fp-ts/ReadonlyArray';
import { flow, pipe } from 'fp-ts/function';
import { renderListItems } from '../../../../../shared-components/render-list-items';
import { HtmlFragment, toHtmlFragment } from '../../../../../types/html-fragment';
import { ListCardViewModel, renderListCard } from '../../../shared-components/list-card';
import { renderListItems } from '../../../shared-components/list-items';
import { renderListOfCards } from '../../../shared-components/list-of-cards';

const renderCards = (cards: ReadonlyArray<HtmlFragment>) => pipe(
Expand Down
2 changes: 1 addition & 1 deletion src/read-side/html-pages/groups-page/render-groups.ts
@@ -1,7 +1,7 @@
import { pipe } from 'fp-ts/function';
import { renderListItems } from '../../../shared-components/render-list-items';
import { supplementaryInfo } from '../../../shared-components/supplementary-info';
import { HtmlFragment, toHtmlFragment } from '../../../types/html-fragment';
import { renderListItems } from '../shared-components/list-items';
import { renderListOfCards } from '../shared-components/list-of-cards';
import { renderSupplementaryCard } from '../shared-components/supplementary-card';

Expand Down
@@ -1,7 +1,7 @@
import * as RA from 'fp-ts/ReadonlyArray';
import { pipe } from 'fp-ts/function';
import { renderListItems } from '../../../../shared-components/render-list-items';
import { HtmlFragment, toHtmlFragment } from '../../../../types/html-fragment';
import { renderListItems } from '../../shared-components/list-items';
import { ViewModel } from '../view-model';

const renderCurationTeaser = (viewModel: ViewModel['curationTeasers'][number]) => toHtmlFragment(`
Expand Down
@@ -1,8 +1,8 @@
import * as RA from 'fp-ts/ReadonlyArray';
import { pipe } from 'fp-ts/function';
import { renderListItems } from '../../../../shared-components/render-list-items';
import { HtmlFragment, toHtmlFragment } from '../../../../types/html-fragment';
import { GroupLinkWithLogoViewModel, renderGroupLinkWithLogo } from '../../shared-components/group-link';
import { renderListItems } from '../../shared-components/list-items';

type GroupsViewModel = ReadonlyArray<GroupLinkWithLogoViewModel>;

Expand Down
@@ -1,12 +1,12 @@
import * as E from 'fp-ts/Either';
import * as RA from 'fp-ts/ReadonlyArray';
import { pipe } from 'fp-ts/function';
import { renderListItems } from '../../../../shared-components/render-list-items';
import { HtmlFragment, toHtmlFragment } from '../../../../types/html-fragment';
import {
ArticleCardWithControlsAndAnnotationViewModel, renderArticleCardWithControlsAndAnnotation,
} from '../../shared-components/article-card-with-controls-and-annotation';
import { renderArticleList } from '../../shared-components/article-list';
import { renderListItems } from '../../shared-components/list-items';
import {
PaperActivityErrorCardViewModel, renderPaperActivityErrorCard,
} from '../../shared-components/paper-activity-summary-card';
Expand Down
@@ -1,8 +1,8 @@
import * as RA from 'fp-ts/ReadonlyArray';
import { pipe } from 'fp-ts/function';
import { renderListItems } from '../../../../shared-components/render-list-items';
import { HtmlFragment, toHtmlFragment } from '../../../../types/html-fragment';
import { renderListCard } from '../../shared-components/list-card';
import { renderListItems } from '../../shared-components/list-items';
import { renderListOfCards } from '../../shared-components/list-of-cards';
import { renderPaginationControls } from '../../shared-components/pagination';
import { ViewModel } from '../view-model';
Expand Down
2 changes: 1 addition & 1 deletion src/read-side/html-pages/my-feed-page/my-feed/my-feed.ts
Expand Up @@ -13,10 +13,10 @@ import {
noEvaluationsYet,
troubleFetchingTryAgain,
} from './static-content';
import { renderListItems } from '../../../../shared-components/render-list-items';
import { GroupId } from '../../../../types/group-id';
import { HtmlFragment, toHtmlFragment } from '../../../../types/html-fragment';
import { UserId } from '../../../../types/user-id';
import { renderListItems } from '../../shared-components/list-items';
import { renderListOfCards } from '../../shared-components/list-of-cards';
import { PageOfItems, paginate, renderLegacyPaginationControls } from '../../shared-components/pagination';
import { renderPaperActivitySummaryCard } from '../../shared-components/paper-activity-summary-card';
Expand Down
Expand Up @@ -2,9 +2,9 @@ import { htmlEscape } from 'escape-goat';
import * as O from 'fp-ts/Option';
import * as RA from 'fp-ts/ReadonlyArray';
import { pipe } from 'fp-ts/function';
import { renderListItems } from '../../../../shared-components/render-list-items';
import { HtmlFragment, toHtmlFragment } from '../../../../types/html-fragment';
import { renderLangAttribute } from '../../shared-components/lang-attribute';
import { renderListItems } from '../../shared-components/list-items';
import { ViewModel } from '../view-model';

const renderGroupLogo = (curationStatement: ViewModel['curationStatements'][number]) => pipe(
Expand Down
Expand Up @@ -2,8 +2,8 @@ import * as RA from 'fp-ts/ReadonlyArray';
import { pipe } from 'fp-ts/function';
import { renderEvaluationPublishedFeedItem } from './render-evaluation-published-feed-item';
import { renderExpressionPublishedFeedItem } from './render-expression-published-feed-item';
import { renderListItems } from '../../../../shared-components/render-list-items';
import { HtmlFragment, toHtmlFragment } from '../../../../types/html-fragment';
import { renderListItems } from '../../shared-components/list-items';
import { FeedItem } from '../view-model';

const renderFeedItem = (feedItem: FeedItem) => {
Expand Down
@@ -1,8 +1,8 @@
import { htmlEscape } from 'escape-goat';
import * as RA from 'fp-ts/ReadonlyArray';
import { flow, pipe } from 'fp-ts/function';
import { renderListItems } from '../../../../shared-components/render-list-items';
import { HtmlFragment, toHtmlFragment } from '../../../../types/html-fragment';
import { renderListItems } from '../../shared-components/list-items';
import { ViewModel } from '../view-model';

const renderList = (listContent: string) => `
Expand Down
@@ -1,9 +1,9 @@
import * as O from 'fp-ts/Option';
import * as RA from 'fp-ts/ReadonlyArray';
import { pipe } from 'fp-ts/function';
import { renderListItems } from '../../../../shared-components/render-list-items';
import { HtmlFragment, toHtmlFragment } from '../../../../types/html-fragment';
import { renderArticleList } from '../../shared-components/article-list';
import { renderListItems } from '../../shared-components/list-items';
import { renderAsHtml } from '../../shared-components/paper-activity-summary-card/render-as-html';
import { ViewModel } from '../view-model';

Expand Down
@@ -1,8 +1,8 @@
import * as RA from 'fp-ts/ReadonlyArray';
import { pipe } from 'fp-ts/function';
import { renderListItems } from '../../../../shared-components/render-list-items';
import { HtmlFragment, toHtmlFragment } from '../../../../types/html-fragment';
import { renderGroupLinkWithLogo } from '../../shared-components/group-link';
import { renderListItems } from '../../shared-components/list-items';
import { ViewModel } from '../view-model';

export const renderReviewingGroups = (reviewingGroups: ViewModel['reviewingGroups']): HtmlFragment => {
Expand Down
Expand Up @@ -2,9 +2,9 @@ import * as O from 'fp-ts/Option';
import * as RA from 'fp-ts/ReadonlyArray';
import { pipe } from 'fp-ts/function';
import { renderScietyFeedCard } from './render-sciety-feed-card';
import { renderListItems } from '../../../../shared-components/render-list-items';
import { supplementaryInfo } from '../../../../shared-components/supplementary-info';
import { HtmlFragment, toHtmlFragment } from '../../../../types/html-fragment';
import { renderListItems } from '../../shared-components/list-items';
import { renderListOfCards } from '../../shared-components/list-of-cards';
import { renderLegacyPaginationControls } from '../../shared-components/pagination';
import { renderSupplementaryCard } from '../../shared-components/supplementary-card';
Expand Down
@@ -1,8 +1,8 @@
import * as RA from 'fp-ts/ReadonlyArray';
import { pipe } from 'fp-ts/function';
import { renderListItems } from '../../../../shared-components/render-list-items';
import { HtmlFragment, toHtmlFragment } from '../../../../types/html-fragment';
import { renderGroupLinkWithLogo } from '../../shared-components/group-link';
import { renderListItems } from '../../shared-components/list-items';
import { ViewModel } from '../view-model';

export const renderRelatedGroups = (relatedGroups: ViewModel['relatedGroups']): HtmlFragment => (relatedGroups.tag === 'some-related-groups'
Expand Down
@@ -1,9 +1,9 @@
import * as O from 'fp-ts/Option';
import * as RNEA from 'fp-ts/ReadonlyNonEmptyArray';
import { pipe } from 'fp-ts/function';
import { renderListItems } from '../../../../shared-components/render-list-items';
import { HtmlFragment, toHtmlFragment } from '../../../../types/html-fragment';
import { renderArticleList } from '../../shared-components/article-list';
import { renderListItems } from '../../shared-components/list-items';

export const renderSearchResultsList = (cards: ReadonlyArray<HtmlFragment>): O.Option<HtmlFragment> => pipe(
cards,
Expand Down
@@ -0,0 +1 @@
export { renderListItems } from './render-list-items';
@@ -1,6 +1,6 @@
import * as RA from 'fp-ts/ReadonlyArray';
import { pipe } from 'fp-ts/function';
import { HtmlFragment, toHtmlFragment } from '../types/html-fragment';
import { HtmlFragment, toHtmlFragment } from '../../../../types/html-fragment';

type ItemClass = string | undefined;

Expand Down
@@ -1,6 +1,5 @@
import * as O from 'fp-ts/Option';
import { pipe } from 'fp-ts/function';
import { renderListItems } from '../../../shared-components/render-list-items';
import * as DE from '../../../types/data-error';
import * as EDOI from '../../../types/expression-doi';
import { toHtmlFragment } from '../../../types/html-fragment';
Expand All @@ -12,6 +11,7 @@ import {
renderArticleCardWithControlsAndAnnotation,
} from '../shared-components/article-card-with-controls-and-annotation';
import { renderListCard } from '../shared-components/list-card';
import { renderListItems } from '../shared-components/list-items';
import { renderListOfCards } from '../shared-components/list-of-cards';
import { renderPaginationControls } from '../shared-components/pagination';
import { renderPaperActivityErrorCard } from '../shared-components/paper-activity-summary-card';
Expand Down
@@ -1,6 +1,6 @@
import { pipe } from 'fp-ts/function';
import { renderListItems } from '../../../../../shared-components/render-list-items';
import { HtmlFragment } from '../../../../../types/html-fragment';
import { renderListItems } from '../../../shared-components/list-items';
import { renderListOfCards } from '../../../shared-components/list-of-cards';

export const renderFollowList = (list: ReadonlyArray<HtmlFragment>): HtmlFragment => pipe(
Expand Down
Expand Up @@ -2,9 +2,9 @@ import * as RA from 'fp-ts/ReadonlyArray';
import { pipe } from 'fp-ts/function';
import { tabList } from './tab-list';
import { pathToSubmitCreateList } from '../../../../../http/form-submission-handlers/submit-paths';
import { renderListItems } from '../../../../../shared-components/render-list-items';
import { HtmlFragment, toHtmlFragment } from '../../../../../types/html-fragment';
import { ListCardViewModel, renderListCard } from '../../../shared-components/list-card';
import { renderListItems } from '../../../shared-components/list-items';
import { renderListOfCards } from '../../../shared-components/list-of-cards';
import { renderTabs } from '../../../shared-components/tabs';
import { ListsTab, ViewModel } from '../view-model';
Expand Down
2 changes: 1 addition & 1 deletion src/shared-components/supplementary-info.ts
@@ -1,5 +1,5 @@
import { pipe } from 'fp-ts/function';
import { renderListItems } from './render-list-items';
import { renderListItems } from '../read-side/html-pages/shared-components/list-items/render-list-items';
import { HtmlFragment, toHtmlFragment } from '../types/html-fragment';

type SupplementaryInfo = (items: ReadonlyArray<HtmlFragment>, modifierClass?: string) => HtmlFragment;
Expand Down

0 comments on commit b668174

Please sign in to comment.