From e73526cbaca5143fad68126f8757c2af3d82a4f6 Mon Sep 17 00:00:00 2001 From: runarvestmann Date: Mon, 30 Dec 2024 10:53:53 +0000 Subject: [PATCH] Remove NewLinks component --- apps/web/components/NewLinks/NewLinks.css.ts | 106 ------------------- apps/web/components/NewLinks/NewLinks.tsx | 73 ------------- apps/web/components/real.ts | 1 - apps/web/screens/Home/Home.tsx | 39 +++---- 4 files changed, 20 insertions(+), 199 deletions(-) delete mode 100644 apps/web/components/NewLinks/NewLinks.css.ts delete mode 100644 apps/web/components/NewLinks/NewLinks.tsx diff --git a/apps/web/components/NewLinks/NewLinks.css.ts b/apps/web/components/NewLinks/NewLinks.css.ts deleted file mode 100644 index 92cb536221c7..000000000000 --- a/apps/web/components/NewLinks/NewLinks.css.ts +++ /dev/null @@ -1,106 +0,0 @@ -import { style } from '@vanilla-extract/css' -import { theme, themeUtils } from '@island.is/island-ui/theme' - -const SPACING = theme.spacing[3] - -export const container = style({ - display: 'flex', - width: '100%', - flexWrap: 'wrap', - flexDirection: 'row', - ...themeUtils.responsiveStyle({ - md: { - flexWrap: 'nowrap', - }, - }), -}) - -export const logo = style({ - display: 'inline-block', - width: '50%', - order: 1, - ...themeUtils.responsiveStyle({ - md: { - width: 'auto', - }, - }), -}) - -export const content = style({ - display: 'inline-flex', - position: 'relative', - whiteSpace: 'nowrap', - flexWrap: 'nowrap', - flexGrow: 1, - flexDirection: 'column', - justifyContent: 'flex-end', - overflow: 'hidden', - order: 3, - marginTop: theme.spacing[2], - marginLeft: -SPACING, - marginRight: -SPACING, - paddingBottom: 1, - ...themeUtils.responsiveStyle({ - md: { - position: 'initial', - order: 2, - marginTop: 0, - marginLeft: 0, - marginRight: SPACING, - }, - }), -}) - -export const truncate = style({ - display: 'inline-block', - width: '100%', - overflowX: 'auto', - scrollbarWidth: 'none', - whiteSpace: 'nowrap', - textOverflow: 'initial', - paddingLeft: SPACING, - ...themeUtils.responsiveStyle({ - md: { - overflowX: 'hidden', - textOverflow: 'ellipsis', - paddingLeft: 0, - }, - }), - selectors: { - [`&::-webkit-scrollbar`]: { - display: 'none', - }, - }, -}) - -export const link = style({ - lineHeight: 1.5, - fontWeight: theme.typography.regular, - fontSize: 12, - paddingRight: SPACING, - ...themeUtils.responsiveStyle({ - md: { - fontSize: 14, - }, - }), - ':hover': { - textDecoration: 'underline', - }, -}) - -export const button = style({ - display: 'none', - width: '50%', - textAlign: 'right', - order: 2, - ...themeUtils.responsiveStyle({ - md: { - order: 3, - width: 'auto', - }, - }), -}) - -export const buttonVisible = style({ - display: 'inline-block', -}) diff --git a/apps/web/components/NewLinks/NewLinks.tsx b/apps/web/components/NewLinks/NewLinks.tsx deleted file mode 100644 index af51b0182995..000000000000 --- a/apps/web/components/NewLinks/NewLinks.tsx +++ /dev/null @@ -1,73 +0,0 @@ -/* eslint-disable jsx-a11y/anchor-is-valid */ -import React from 'react' -import cn from 'classnames' -import NextLink from 'next/link' -import { Box, Inline, Logo, Text, Button } from '@island.is/island-ui/core' -import { useDateUtils } from '@island.is/web/i18n/useDateUtils' - -import * as styles from './NewLinks.css' - -type Item = { - date: Date - text: string - href: string -} - -interface NewLinksProps { - heading?: string - items?: Item[] - showMoreButton?: boolean - seeMoreText?: string -} - -export const NewLinks = ({ - items = [], - heading = '', - showMoreButton = false, - seeMoreText = '', -}: NewLinksProps) => { - const { format } = useDateUtils() - - return ( - - - - - {heading} - - -
-
- {items.map(({ date, text, href }, index) => ( - - {format(new Date(date), 'dd/MM')} {text} - - ))} -
-
- - - -
- ) -} - -export default NewLinks diff --git a/apps/web/components/real.ts b/apps/web/components/real.ts index bcf7523b139d..0bfb24cebd7a 100644 --- a/apps/web/components/real.ts +++ b/apps/web/components/real.ts @@ -70,7 +70,6 @@ export * from './Login/LoginTexts.types' export * from './IconTitleCard/IconTitleCard' export * from './SearchSection/SearchSection' export * from './CategoryItems/CategoryItems' -export * from './NewLinks/NewLinks' export * from './NewsItems/NewsItems' export * from './GridItems/GridItems' export * from './LifeEventsSection/LifeEventsSection' diff --git a/apps/web/screens/Home/Home.tsx b/apps/web/screens/Home/Home.tsx index 98bd37bb102a..17eda4ae271c 100644 --- a/apps/web/screens/Home/Home.tsx +++ b/apps/web/screens/Home/Home.tsx @@ -1,34 +1,35 @@ import React, { useContext } from 'react' -import { Box, GridContainer } from '@island.is/island-ui/core' -import { useI18n } from '@island.is/web/i18n' -import { Screen } from '@island.is/web/types' -import { useNamespace } from '@island.is/web/hooks' + +import { LifeEventPage, QueryGetNewsArgs } from '@island.is/api/schema' +import { Box } from '@island.is/island-ui/core' +import { Locale } from '@island.is/shared/types' +import { + CategoryItems, + LifeEventsSection, + NewsItems, + SearchSection, + WatsonChatPanel, +} from '@island.is/web/components' +import { FRONTPAGE_NEWS_TAG_ID } from '@island.is/web/constants' +import { GlobalContext } from '@island.is/web/context' import { ContentLanguage, - QueryGetArticleCategoriesArgs, GetArticleCategoriesQuery, GetFrontpageQuery, - QueryGetFrontpageArgs, GetNewsQuery, + QueryGetArticleCategoriesArgs, + QueryGetFrontpageArgs, } from '@island.is/web/graphql/schema' +import { useNamespace } from '@island.is/web/hooks' +import { useI18n } from '@island.is/web/i18n' +import { withMainLayout } from '@island.is/web/layouts/main' import { GET_CATEGORIES_QUERY, GET_FRONTPAGE_QUERY, GET_NEWS_QUERY, } from '@island.is/web/screens/queries' -import { - SearchSection, - CategoryItems, - NewLinks, - NewsItems, - LifeEventsSection, - WatsonChatPanel, -} from '@island.is/web/components' -import { withMainLayout } from '@island.is/web/layouts/main' -import { GlobalContext } from '@island.is/web/context' -import { LifeEventPage, QueryGetNewsArgs } from '@island.is/api/schema' -import { FRONTPAGE_NEWS_TAG_ID } from '@island.is/web/constants' -import { Locale } from '@island.is/shared/types' +import { Screen } from '@island.is/web/types' + import { watsonConfig } from './config' interface HomeProps {