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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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