Upgrade parts

Signed-off-by: soupette <cyril@strapi.io>
This commit is contained in:
soupette 2021-09-09 15:14:58 +02:00
parent eba7a9337d
commit cba6116d83
15 changed files with 50 additions and 42 deletions

View File

@ -1,8 +1,7 @@
import React from 'react';
import PropTypes from 'prop-types';
import { FormattedMessage } from 'react-intl';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { useIntl } from 'react-intl';
import { useHistory } from 'react-router-dom';
import {
MainNav,
@ -24,6 +23,7 @@ const LeftMenu = ({ generalSectionLinks, pluginsSectionLinks }) => {
const { push } = useHistory();
const [condensed, setCondensed] = usePersistentState('navbar-condensed', false);
const { userDisplayName } = useAppInfos();
const { formatMessage } = useIntl();
return (
<MainNav condensed={condensed}>
@ -37,14 +37,14 @@ const LeftMenu = ({ generalSectionLinks, pluginsSectionLinks }) => {
<NavSections>
<NavLink to="/content-manager" icon={<ContentIcon />}>
<FormattedMessage id="content-manager.plugin.name" defaultMessage="Content manager" />
{formatMessage({ id: 'content-manager.plugin.name', defaultMessage: 'Content manager' })}
</NavLink>
{pluginsSectionLinks.length > 0 ? (
<NavSection label="Plugins">
{pluginsSectionLinks.map(link => (
<NavLink to={link.to} key={link.to} icon={<FontAwesomeIcon icon={link.icon} />}>
<FormattedMessage {...link.intlLabel} />
{formatMessage(link.intlLabel)}
</NavLink>
))}
</NavSection>
@ -54,12 +54,14 @@ const LeftMenu = ({ generalSectionLinks, pluginsSectionLinks }) => {
<NavSection label="General">
{generalSectionLinks.map(link => (
<NavLink
badgeContent={link.notificationsCount > 0 && link.notificationsCount}
badgeContent={
(link.notificationsCount > 0 && link.notificationsCount.toString()) || undefined
}
to={link.to}
key={link.to}
icon={<FontAwesomeIcon icon={link.icon} />}
>
<FormattedMessage {...link.intlLabel} />
{formatMessage(link.intlLabel)}
</NavLink>
))}
{/* This is temporary */}
@ -81,11 +83,15 @@ const LeftMenu = ({ generalSectionLinks, pluginsSectionLinks }) => {
</NavUser>
<NavCondense onClick={() => setCondensed(s => !s)}>
{condensed ? (
<FormattedMessage id="app.components.LeftMenu.expand" />
) : (
<FormattedMessage id="app.components.LeftMenu.collapse" />
)}
{condensed
? formatMessage({
id: 'app.components.LeftMenu.expand',
defaultMessage: 'Expand the navbar',
})
: formatMessage({
id: 'app.components.LeftMenu.collapse',
defaultMessage: 'Collapse the navbar',
})}
</NavCondense>
</MainNav>
);

View File

@ -71,7 +71,7 @@ const LeftMenu = () => {
});
return (
<SubNav arialLabel={label}>
<SubNav ariaLabel={label}>
<SubNavHeader
label={label}
searchable

View File

@ -449,6 +449,7 @@ describe('Content manager | App | main', () => {
class="c0"
>
<nav
aria-label="label"
class="c1"
>
<div

View File

@ -26,7 +26,7 @@ const TableHead = ({
const sort = query.sort || '';
const [sortBy, sortOrder] = sort.split(':');
const isIndeterminate = !areAllEntriesSelected && entriesToDelete.length;
const isIndeterminate = !areAllEntriesSelected && entriesToDelete.length > 0;
return (
<Thead>

View File

@ -1,6 +1,6 @@
import React from 'react';
import PropTypes from 'prop-types';
import { Select, Field, Stack, FieldInput, Option } from '@strapi/parts';
import { Select, Field, FieldInput, Option } from '@strapi/parts';
const Inputs = ({ onChange, type, value }) => {
if (type === 'boolean') {
@ -16,9 +16,7 @@ const Inputs = ({ onChange, type, value }) => {
return (
<Field>
<Stack>
<FieldInput onChange={({ target: { value } }) => onChange(value)} value={value} size="S" />
</Stack>
<FieldInput onChange={({ target: { value } }) => onChange(value)} value={value} size="S" />
</Field>
);
};

View File

@ -1172,7 +1172,9 @@ describe('ADMIN | Pages | USERS | ListPage', () => {
>
<div
class="c35"
/>
>
Loading content...
</div>
<img
aria-hidden="true"
class="c41"

View File

@ -3,7 +3,7 @@
* EditView
*
*/
import React, { useCallback, useMemo } from 'react';
import {
LoadingIndicatorPage,
request,
@ -13,7 +13,6 @@ import {
useOverlayBlocker,
} from '@strapi/helper-plugin';
import { Main } from '@strapi/parts';
import React, { useCallback, useMemo } from 'react';
import { useMutation, useQuery, useQueryClient } from 'react-query';
import { useHistory, useRouteMatch } from 'react-router-dom';
import WebhookForm from './components/WebhookForm';

View File

@ -256,7 +256,7 @@
"app.components.LeftMenuLinkContainer.plugins": "Plugins",
"app.components.LeftMenuLinkContainer.settings": "Settings",
"app.components.LeftMenuLinkContainer.singleTypes": "Single Types",
"app.components.LeftMenu.expand": "Expanded the navbar",
"app.components.LeftMenu.expand": "Expand the navbar",
"app.components.LeftMenu.collapse": "Collapse the navbar",
"app.components.ListPluginsPage.deletePlugin.description": "It might take a few seconds to uninstall the plugin.",
"app.components.ListPluginsPage.deletePlugin.title": "Uninstalling",

View File

@ -109,7 +109,7 @@ export const SingleSignOn = () => {
<Stack size={12}>
<Box background="neutral0" padding={6} shadow="filterShadow" hasRadius>
<Grid gap={4}>
<GridItem col="6" m="6" s="12">
<GridItem col={6} m={6} s={12}>
<ToggleInput
aria-label="autoRegister"
data-testid="autoRegister"
@ -139,7 +139,7 @@ export const SingleSignOn = () => {
}}
/>
</GridItem>
<GridItem col="6" m="6" s="12">
<GridItem col={6} m={6} s={12}>
<Select
disabled={!canUpdate}
hint={formatMessage({

View File

@ -40,8 +40,8 @@
"@fortawesome/react-fontawesome": "^0.1.14",
"@strapi/babel-plugin-switch-ee-ce": "1.0.0",
"@strapi/helper-plugin": "3.6.8",
"@strapi/icons": "0.0.1-alpha.23",
"@strapi/parts": "0.0.1-alpha.23",
"@strapi/icons": "0.0.1-alpha.25",
"@strapi/parts": "0.0.1-alpha.25",
"@strapi/utils": "3.6.8",
"axios": "^0.21.1",
"babel-loader": "8.2.2",

View File

@ -12,7 +12,7 @@ const EmptyBodyTable = ({ colSpan, isLoading, ...rest }) => {
<Td colSpan={colSpan}>
<Row justifyContent="center">
<Box padding={11} background="neutral0">
<Loader />
<Loader>Loading content...</Loader>
</Box>
</Row>
</Td>

View File

@ -57,8 +57,8 @@
"@storybook/builder-webpack5": "^6.3.7",
"@storybook/manager-webpack5": "^6.3.7",
"@storybook/react": "^6.3.7",
"@strapi/icons": "0.0.1-alpha.23",
"@strapi/parts": "0.0.1-alpha.23",
"@strapi/icons": "0.0.1-alpha.25",
"@strapi/parts": "0.0.1-alpha.25",
"babel-loader": "^8.2.2",
"cross-env": "^7.0.3",
"enzyme": "^3.8.0",

View File

@ -168,7 +168,7 @@ export const SettingsPage = () => {
</H3>
</Row>
<Grid gap={6}>
<GridItem col="6" s="12">
<GridItem col={6} s={12}>
<ToggleInput
aria-label="responsiveDimensions"
data-testid="responsiveDimensions"
@ -198,7 +198,7 @@ export const SettingsPage = () => {
}}
/>
</GridItem>
<GridItem col="6" s="12">
<GridItem col={6} s={12}>
<ToggleInput
aria-label="sizeOptimization"
data-testid="sizeOptimization"
@ -223,7 +223,7 @@ export const SettingsPage = () => {
}}
/>
</GridItem>
<GridItem col="6" s="12">
<GridItem col={6} s={12}>
<ToggleInput
aria-label="autoOrientation"
data-testid="autoOrientation"

View File

@ -1,3 +1,4 @@
/* eslint-disable react/jsx-indent */
import React from 'react';
import styled from 'styled-components';
import { Select, Option } from '@strapi/parts/Select';
@ -60,13 +61,14 @@ const LocaleSelect = React.memo(({ value, onLocaleChange, error, onClear }) => {
onLocaleChange({ code: selectedLocale.value, displayName: selectedLocale.label });
}
}}
placeholder={formatMessage({ id: 'components.placeholder.select', defaultMessage: 'Select' })}
>
{isLoading
? null
: options.map(option => (
<Option value={option.value} key={option.value}>
{option.label}
</Option>
<Option value={option.value} key={option.value}>
{option.label}
</Option>
))}
</Select>
);

View File

@ -4910,15 +4910,15 @@
resolve-from "^5.0.0"
store2 "^2.12.0"
"@strapi/icons@0.0.1-alpha.23":
version "0.0.1-alpha.23"
resolved "https://registry.yarnpkg.com/@strapi/icons/-/icons-0.0.1-alpha.23.tgz#e2474d8c431b2c270c1bbcd0c15d53e644686d82"
integrity sha512-6le+sn4yhJqdqzVjMTEGSQWecx79alTDoHEVTKLimea0cGN/vhSyGrOD9k0ef+8DCz+OkOgcu3RwnPQHj34iwA==
"@strapi/icons@0.0.1-alpha.25":
version "0.0.1-alpha.25"
resolved "https://registry.yarnpkg.com/@strapi/icons/-/icons-0.0.1-alpha.25.tgz#59c1b9258bb92784fc323e8ba18f2417bc722aea"
integrity sha512-bhieHD4XXeMilqcXzPTvwIpddWpNxSXwYWfEfWwRmqaFoNkGBdSLPEhKkwNTmqBuqsBgvgao3CJ8eADoKQzv7g==
"@strapi/parts@0.0.1-alpha.23":
version "0.0.1-alpha.23"
resolved "https://registry.yarnpkg.com/@strapi/parts/-/parts-0.0.1-alpha.23.tgz#0822079fab14fd0795e51d634b3314079d2b0c86"
integrity sha512-ESmmJJu+uJLnPSmbaS5Xs73Ak0MOfQ5NZjczuI+ZQrnR3Hq7C/Pnw2id6MpbwtmIGCuIAH7bKEJciDIXvNpL3Q==
"@strapi/parts@0.0.1-alpha.25":
version "0.0.1-alpha.25"
resolved "https://registry.yarnpkg.com/@strapi/parts/-/parts-0.0.1-alpha.25.tgz#b6121d880cd8c1e4670411a9bcb508da9d95e165"
integrity sha512-OuiJRs1U1T/vF4ZxJic28/rEJMQWPjrsKojA6WUo2GWg7RB2gFQHrITp4smQOo7Bi+6mQv85ON+ywGeNVsOOmg==
dependencies:
"@internationalized/number" "^3.0.2"
compute-scroll-into-view "^1.0.17"