Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: remove line-clamp as now part of default for tailwind #68

Closed
wants to merge 27 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
117a5a5
chore(SLB-261): high volume content test
Leksat Mar 7, 2024
27c013e
chore(SLB-261): typo
Leksat Mar 7, 2024
e2d4103
chore(SLB-261): fix gatsby tasks
Leksat Mar 7, 2024
cbc2b21
chore(SLB-261): debug
Leksat Mar 7, 2024
4e84bb0
fix: fix decap turbo setup
Leksat Mar 7, 2024
af1c620
chore(SLB-261): un-debug
Leksat Mar 7, 2024
0e332d9
chore: prettier to ignore .turbo
Leksat Mar 11, 2024
938a824
chore: add test:format:fix
Leksat Mar 11, 2024
b0c4b00
fix: gatsby config file to mjs in init.md
benellefimostfa Mar 13, 2024
006c5b1
Update Page “decap-example”
pmelab Mar 14, 2024
dd01d1f
fix(SLB-269): special handling for home page translations
pmelab Mar 15, 2024
d21c156
style: flowbite loading component
Jan 26, 2024
9a1bed8
style: flowbite contenthub cards + loading + searchform adjustments
Jan 26, 2024
6ca94ac
style: flowbitify footer
Jan 26, 2024
8e64fbe
style: flowbitify header
Feb 9, 2024
c2fd864
fix: tests fix
Feb 9, 2024
798e7fe
feat(SLB-216): fix testes
Feb 13, 2024
9b00d9f
chore: bring @storybook/jest package
Feb 13, 2024
fc6d708
chore: remove @storybook/jest which has been replaced with @storybook…
pmelab Mar 15, 2024
4772763
chore: formatting fixes
pmelab Mar 15, 2024
5595379
fix: leftover use of react-intl-rsc
pmelab Mar 15, 2024
d090941
fix: make decap handle removed translatables gracefully
pmelab Mar 15, 2024
5d26540
fix: wrap footer navigation in <nav>
pmelab Mar 15, 2024
fae50f2
feat: move language switcher into user actions area
pmelab Mar 15, 2024
099444d
feat(SLB-272): add default flowbite style to webform
mattiasimonato Mar 1, 2024
28da7bd
fix: remove line-clamp as now part of default for tailwind
dan2k3k4 May 10, 2023
9b86aaa
chore: remove line-clamp package
pmelab Mar 15, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 50 additions & 0 deletions .github/workflows/high_content_volume.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: High Content Volume
on:
workflow_dispatch:

jobs:
test:
name: Test
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 1

- name: Setup
uses: ./.github/actions/setup

- name: TurboRepo local server
uses: felixmosh/turborepo-gh-artifacts@v2
with:
server-token: 'local'
repo-token: ${{ secrets.GITHUB_TOKEN }}

- name: Prepare
run: pnpm turbo:prep
env:
TURBO_API: 'http://127.0.0.1:9080'
TURBO_TOKEN: 'local'
TURBO_TEAM: 'local'

- name: 'Drupal: Start'
run: pnpm --filter "@custom/cms" start &

- name: 'Gatsby: Clean'
run: pnpm --filter "@custom/website" clean

- name: 'Drupal: Create content'
run: pnpm --filter "@custom/cms" drush php:script scripts/create-lots-of-content/run.php

- name: 'Gatsby: Full build'
run: pnpm --filter "@custom/website" build:gatsby

- name: 'Gatsby: Incremental build without new content'
run: pnpm --filter "@custom/website" build:gatsby

- name: 'Drupal: Create more content'
run: pnpm --filter "@custom/cms" drush php:script scripts/create-lots-of-content/create-100-pages.php

- name: 'Gatsby: Incremental build with new content'
run: pnpm --filter "@custom/website" build:gatsby

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ _local
apps
packages
tests
.turbo
2 changes: 1 addition & 1 deletion INIT.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ Update the auth key for Gatsby user.
```ts
const authKey = randomString(32);
replace(
'apps/website/gatsby-config.js',
'apps/website/gatsby-config.mjs',
"auth_key: 'cfdb0555111c0f8924cecab028b53474'",
`auth_key: '${authKey}'`,
);
Expand Down
99 changes: 99 additions & 0 deletions apps/cms/scripts/create-lots-of-content/create-100-pages.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
<?php

use Drupal\Component\Utility\Random;
use Drupal\media\Entity\Media;
use Drupal\node\Entity\Node;


/** @var \Drupal\file\FileRepositoryInterface $fileRepository */
$fileRepository = \Drupal::service('file.repository');
$random = new Random();

$imageData = file_get_contents(__DIR__ . '/tiny.png');

for ($pageIndex = 1; $pageIndex <= 100; $pageIndex++) {

// Prepare images.
/** @var \Drupal\file\FileInterface[] $images */
$images = [];
for ($i = 1; $i <= 4; $i++) {
$images[$i] = $fileRepository->writeData($imageData, "public://" . $random->machineName(32) . ".png");
}

// Prepare image media entities.
/** @var \Drupal\media\MediaInterface[] $media */
$media = [];
foreach ($images as $i => $image) {
$media[$i] = Media::create([
'name' => $random->name(),
'bundle' => 'image',
'uid' => 1,
'status' => TRUE,
'field_media_image' => [
'target_id' => $image->id(),
'alt' => 'Alt text',
'title' => 'Title text',
],
]);
$media[$i]->save();
}
$mediaIds = array_map(fn ($media) => $media->id(), $media);

// Create a page.
$title = $random->name();
$node = Node::create([
'type' => 'page',
'status' => TRUE,
'uid' => 1,
'title' => $title,
'moderation_state' => 'published',
'body' => [
'value' => pageBody($mediaIds, FALSE),
'format' => 'gutenberg',
'summary' => '',
],
]);
$node->addTranslation('de', [
'title' => $title . ' DE',
'uid' => 1,
'body' => [
'value' => pageBody($mediaIds, TRUE),
'format' => 'gutenberg',
'summary' => '',
],
]);
$node->save();
}

function pageBody(array $mediaIds, bool $isGerman): string {
$suffix = $isGerman ? ' DE' : '';
return <<<EOT
<!-- wp:custom/hero {"mediaEntityIds":["$mediaIds[1]"],"headline":"Stub page$suffix","lead":"Lead text$suffix"} /-->

<!-- wp:custom/content -->
<!-- wp:paragraph -->
<p>Some content$suffix</p>
<!-- /wp:paragraph -->

<!-- wp:drupalmedia/drupal-media-entity {"mediaEntityIds":["$mediaIds[2]"],"caption":"Caption$suffix"} /-->

<!-- wp:paragraph -->
<p>Some content$suffix</p>
<!-- /wp:paragraph -->

<!-- wp:drupalmedia/drupal-media-entity {"mediaEntityIds":["$mediaIds[3]"],"caption":"Caption$suffix"} /-->

<!-- wp:paragraph -->
<p><meta charset="utf-8">Some content$suffix</p>
<!-- /wp:paragraph -->

<!-- wp:drupalmedia/drupal-media-entity {"mediaEntityIds":["$mediaIds[4]"],"caption":"Caption$suffix"} /-->

<!-- wp:paragraph -->
<p></p>
<!-- /wp:paragraph -->
<!-- /wp:custom/content -->
EOT;
}


21 changes: 21 additions & 0 deletions apps/cms/scripts/create-lots-of-content/run.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php

$amount = 200;
$total = $amount * 100;

echo "Gonna create $total pages.\n";

for ($i = 1; $i <= $amount; $i++) {

// The more pages we create in a single run, the slower Drupal works and the
// more memory is eaten by PHP. So we create pages in batches.
exec('../vendor/bin/drush php:script ' . __DIR__ . '/create-100-pages.php');

if ($i !== 1) {
echo "\r";
}
$percent = number_format(100 * $i / $amount, 2);
echo "Progress $percent%";
}

echo "\nDone!\n";
Binary file added apps/cms/scripts/create-lots-of-content/tiny.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions apps/decap/data/page/decap-example.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
de:
path: /de/decap-example
title: Decap Beispiel
title: Decap Beispiel!
teaserImage: /apps/decap/media/landscape.jpg
hero:
headline: Decap Beispiel
Expand All @@ -12,7 +12,7 @@ de:
en:
id: BTPzQnq79fWNOF1dFmESP
path: /en/decap-example
title: Decap example
title: Decap example!
teaserImage: /apps/decap/media/landscape.jpg
hero:
headline: Decap Example
Expand Down
20 changes: 11 additions & 9 deletions apps/decap/src/collections/translatables.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,17 @@ export function getTranslatables(
Object.keys(data).forEach((langcode) => {
Object.keys(data[langcode]).forEach((key) => {
Object.keys(data).forEach((locale) => {
translations.push([
`${key}:${locale}`,
{
__typename: 'DecapTranslatableString',
source: translationSources[key],
language: locale as Locale,
translation: data[locale][key],
},
]);
if (translationSources[key]) {
translations.push([
`${key}:${locale}`,
{
__typename: 'DecapTranslatableString',
source: translationSources[key],
language: locale as Locale,
translation: data[locale][key],
},
]);
}
});
});
});
Expand Down
4 changes: 2 additions & 2 deletions apps/decap/turbo.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
"prep:vite": {
"dependsOn": ["^prep"],
"inputs": ["src/**", "vite.config.js"],
"outputs": ["build/**"]
"outputs": ["dist/**"]
},
"prep:scripts": {
"dependsOn": ["^prep"],
"inputs": ["src/**", "tsup.config.js"],
"outputs": ["dist/**"]
"outputs": ["build/**"]
},
"prep": {
"dependsOn": ["prep:vite", "prep:scripts"]
Expand Down
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@
"scripts": {
"postinstall": "husky install || true",
"commit": "git-cz",
"test:format": "pnpm test:format:root && pnpm test:format:workspaces",
"test:format:root": "pnpm prettier --check '**/*.{js,cjs,mjs,ts,jsx,tsx,gql,graphql,graphqls,md,mdx,json}' --ignore-path='./.prettierignore'",
"test:format:workspaces": "pnpm --workspace-concurrency=1 -r exec prettier --check '**/*.{js,cjs,mjs,ts,jsx,tsx,gql,graphql,graphqls,md,mdx,json}' --ignore-path='./.gitignore'",
"test:format": "pnpm test:format:root --check && pnpm test:format:workspaces --check",
"test:format:fix": "pnpm test:format:root --write && pnpm test:format:workspaces --write",
"test:format:root": "pnpm prettier '**/*.{js,cjs,mjs,ts,jsx,tsx,gql,graphql,graphqls,md,mdx,json}' --ignore-path='./.prettierignore'",
"test:format:workspaces": "pnpm --workspace-concurrency=1 -r exec prettier '**/*.{js,cjs,mjs,ts,jsx,tsx,gql,graphql,graphqls,md,mdx,json}' --ignore-path='./.gitignore'",
"turbo:local": "if [ -z $CI ]; then echo $(date)$RANDOM > apps/cms/turbo-seed.txt; fi",
"turbo:test": "pnpm turbo:local && turbo test:unit --no-daemon --go-fallback --output-logs=new-only && turbo test:integration --no-daemon --go-fallback --output-logs=new-only --concurrency=1",
"turbo:test:quick": "pnpm turbo:local && turbo test:unit --no-daemon --go-fallback --output-logs=new-only",
Expand Down
8 changes: 8 additions & 0 deletions packages/schema/src/operations/Frame.gql
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
query Frame {
websiteSettings {
homePage {
translations {
locale
path
}
}
}
mainNavigation: mainNavigations {
...Navigation
}
Expand Down
1 change: 0 additions & 1 deletion packages/ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@
"@swc/core": "^1.3.102",
"@tailwindcss/aspect-ratio": "^0.4.2",
"@tailwindcss/forms": "^0.5.7",
"@tailwindcss/line-clamp": "^0.4.4",
"@tailwindcss/typography": "^0.5.10",
"@testing-library/react": "^14.1.2",
"@types/hast": "^2.3.9",
Expand Down
93 changes: 70 additions & 23 deletions packages/ui/src/components/Client/DesktopMenu.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
'use client';
import { Popover, Transition } from '@headlessui/react';
import { Disclosure, Popover, Transition } from '@headlessui/react';
import { ChevronDownIcon } from '@heroicons/react/20/solid';
import React, { Fragment, PropsWithChildren } from 'react';
import clsx from 'clsx';
import React, { PropsWithChildren } from 'react';

import { avoidFocusOnClick } from '../../utils/avoidFocusOnClick';

export function DesktopMenu({ children }: PropsWithChildren<{}>) {
return (
Expand All @@ -17,27 +20,71 @@ export function DesktopMenuDropDown({
}: PropsWithChildren<{ title: string }>) {
return (
<Popover className="relative">
<Popover.Button className="flex items-center gap-x-1 text-sm font-semibold leading-6 text-gray-900">
{title}
<ChevronDownIcon
className="h-5 w-5 flex-none text-gray-400"
aria-hidden="true"
/>
</Popover.Button>

<Transition
as={Fragment}
enter="transition ease-out duration-200"
enterFrom="opacity-0 translate-y-1"
enterTo="opacity-100 translate-y-0"
leave="transition ease-in duration-150"
leaveFrom="opacity-100 translate-y-0"
leaveTo="opacity-0 translate-y-1"
>
<Popover.Panel className="absolute -left-8 top-full z-10 mt-3 w-56 rounded-xl bg-white p-2 shadow-lg ring-1 ring-gray-900/5">
{children}
</Popover.Panel>
</Transition>
{({ open }) => (
<React.Fragment>
<Popover.Button
className={clsx(
'flex items-center text-base font-medium ml-8 hover:text-blue-600',
open ? 'text-blue-600' : 'text-gray-600',
)}
onClick={() => avoidFocusOnClick()}
>
{title}
<ChevronDownIcon
className={clsx(
'h-5 w-5 flex-none text-blue-600',
open && 'rotate-180',
)}
aria-hidden="true"
/>
</Popover.Button>
<Transition
as={React.Fragment}
enter="transition ease-out duration-200"
enterFrom="opacity-0 translate-y-1"
enterTo="opacity-100 translate-y-0"
leave="transition ease-in duration-150"
leaveFrom="opacity-100 translate-y-0"
leaveTo="opacity-0 translate-y-1"
>
<Popover.Panel
static
className="absolute left-8 top-full z-10 mt-3 w-56 rounded bg-white shadow-md ring-1 ring-gray-100"
>
{children}
</Popover.Panel>
</Transition>
</React.Fragment>
)}
</Popover>
);
}

export function DesktopMenuDropdownDisclosure({
title,
children,
}: PropsWithChildren<{ title: string }>) {
return (
<Disclosure as="div" className="">
{({ open }) => (
<div className={clsx('m-1.5 rounded', open && 'bg-gray-100')}>
<Disclosure.Button
className={clsx(
'flex w-full items-center justify-between px-2 py-1 text-sm leading-[1.25rem] hover:text-blue-600',
open ? 'text-blue-600 font-medium' : 'text-gray-500',
)}
>
{title}
<ChevronDownIcon
className={clsx('h-5 w-5 flex-none text-blue-600', {
'rotate-180': open,
})}
aria-hidden="true"
/>
</Disclosure.Button>
<Disclosure.Panel className="">{children}</Disclosure.Panel>
</div>
)}
</Disclosure>
);
}
Loading
Loading