Skip to content

docs: update version table #6266

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

Merged
merged 1 commit into from
Aug 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
77 changes: 67 additions & 10 deletions .storybook/components/VersionTable.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
import { MessageStrip } from '@ui5/webcomponents-react';
import { Button, MessageStrip } from '@ui5/webcomponents-react';
import { ThemingParameters } from '@ui5/webcomponents-react-base';
import { Fragment, useState } from 'react';
import versionInfo from '../../config/version-info.json';
import iconArrowRight from '@ui5/webcomponents-icons/dist/slim-arrow-right.js';
import iconArrowDown from '@ui5/webcomponents-icons/dist/slim-arrow-down.js';

const allWCRVersions = Object.values(versionInfo);
const allWCRVersions: string[] = Object.values(versionInfo);

export function VersionTable() {
const [expanded, setExpanded] = useState(false);
return (
<>
<MessageStrip hideCloseButton>
Expand Down Expand Up @@ -34,7 +39,8 @@ export function VersionTable() {
const nextVersion = allWCRVersions[currentWCRIndex + 1];
const currentMajor = parseInt(wcrVersion.split('.')[0]);
const currentMinor = parseInt(wcrVersion.split('.')[1]);
const wcrVersions = [`~${wcrVersion}`];
const lastV1 = currentMajor === 1 && currentMinor === 27;
const wcrVersions = [lastV1 ? wcrVersion : `~${wcrVersion}`];
if (nextVersion) {
let minor = parseInt(nextVersion.split('.')[1]);
for (let i = currentMinor + 1; i < minor; i++) {
Expand All @@ -43,13 +49,64 @@ export function VersionTable() {
}

return (
<tr key={wcrVersion}>
<td>
{lastEntry ? '>= ' : ''}
{wcrVersions.join(', ')}
</td>
<td>~{wcVersion}</td>
</tr>
<Fragment key={wcrVersion}>
{wcrVersion === '1.0.1' && (
<tr>
<td colSpan={2}>
<Button
data-ui5-compact-size
icon={expanded ? iconArrowDown : iconArrowRight}
design="Transparent"
onClick={() => {
setExpanded((prev) => !prev);
}}
/>
<span
style={{
fontSize: ThemingParameters.sapFontLargeSize,
fontFamily: ThemingParameters.sapFontBoldFamily,
marginInlineStart: '0.5rem'
}}
>
Version 1
</span>
</td>
</tr>
)}
{currentMajor === 1 && expanded && (
<tr>
<td>
{lastV1 ? '^' : ''}
{wcrVersions.join(', ')}
</td>
<td>~{wcVersion}</td>
</tr>
)}
{wcrVersion === '2.0.0' && (
<tr>
<td colSpan={2}>
<span
style={{
fontSize: ThemingParameters.sapFontLargeSize,
fontFamily: ThemingParameters.sapFontBoldFamily,
marginInlineEnd: '0.5rem'
}}
>
Version 2
</span>
</td>
</tr>
)}
{currentMajor === 2 && (
<tr>
<td>
{lastEntry ? '>= ' : ''}
{wcrVersions.join(', ')}
</td>
<td>~{wcVersion}</td>
</tr>
)}
</Fragment>
);
})}
</tbody>
Expand Down
3 changes: 2 additions & 1 deletion config/version-info.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,6 @@
"1.21.0": "1.24.0",
"1.22.0": "1.25.0",
"1.23.1": "1.26.0",
"1.24.0": "1.27.0"
"1.24.0": "1.27.0",
"2.1.2": "2.0.0"
}
Loading