-
Notifications
You must be signed in to change notification settings - Fork 305
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
feat(content-sidebar): Add placehoder metadatasidebar redesigned #3570
Merged
mergify
merged 9 commits into
box:master
from
jankowiakdawid:add-placehoder-metadatasidebar-redesigned
Jul 18, 2024
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
f09a3c7
feat(content-sidebar): Introduce redesigned MetadataSidebar placeholder
jankowiakdawid 2fb9960
feat(content-sidebar): Use isFeatureEnabled utility
jankowiakdawid 14da29f
feat(content-sidebar): Remove lint disabling comments
jankowiakdawid 7a8672c
feat(content-sidebar): Rename component to MetadataSidebarRedesign
jankowiakdawid 96490ff
feat(content-sidebar): Rename constant value to match it's name
jankowiakdawid 4cfef1f
feat(content-sidebar): Rename class name to follow SUIT naming
jankowiakdawid f65408b
feat(content-sidebar): Remove unneeded ref and constant
jankowiakdawid 89839c2
feat(content-sidebar): Remove unneeded constant
jankowiakdawid 8e3e443
feat(content-sidebar): Add performance mark for MetadataSidebarRedesign
jankowiakdawid File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
@import '../common/variables'; | ||
|
||
.bcs-MetadataSidebarRedesign { | ||
padding-inline: 10px; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/** | ||
* @file Redesigned Metadata sidebar component | ||
* @author Box | ||
*/ | ||
import * as React from 'react'; | ||
import flow from 'lodash/flow'; | ||
import { FormattedMessage } from 'react-intl'; | ||
import { withAPIContext } from '../common/api-context'; | ||
import { withErrorBoundary } from '../common/error-boundary'; | ||
import { withLogger } from '../common/logger'; | ||
import { ORIGIN_METADATA_SIDEBAR_REDESIGN } from '../../constants'; | ||
import { EVENT_JS_READY } from '../common/logger/constants'; | ||
import { mark } from '../../utils/performance'; | ||
import messages from '../common/messages'; | ||
|
||
import './MetadataSidebarRedesign.scss'; | ||
|
||
const MARK_NAME_JS_READY = `${ORIGIN_METADATA_SIDEBAR_REDESIGN}_${EVENT_JS_READY}`; | ||
|
||
mark(MARK_NAME_JS_READY); | ||
|
||
function MetadataSidebarRedesign() { | ||
return ( | ||
<div className="bcs-MetadataSidebarRedesign"> | ||
<h3> | ||
<FormattedMessage {...messages.sidebarMetadataTitle} /> | ||
</h3> | ||
<hr /> | ||
<p>Hello from Metadata Sidebar redesign</p> | ||
</div> | ||
); | ||
} | ||
|
||
export { MetadataSidebarRedesign as MetadataSidebarRedesignComponent }; | ||
export default flow([ | ||
withLogger(ORIGIN_METADATA_SIDEBAR_REDESIGN), | ||
withErrorBoundary(ORIGIN_METADATA_SIDEBAR_REDESIGN), | ||
withAPIContext, | ||
])(MetadataSidebarRedesign); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
src/elements/content-sidebar/__tests__/MetadataSidebarRedesigned.test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import React from 'react'; | ||
import { IntlProvider } from 'react-intl'; | ||
|
||
import { screen, render } from '@testing-library/react'; | ||
|
||
import { MetadataSidebarRedesignComponent as MetadataSidebar } from '../MetadataSidebarRedesign'; | ||
|
||
jest.unmock('react-intl'); | ||
|
||
describe('elements/content-sidebar/Metadata/MetadataSidebarRedesigned', () => { | ||
const renderComponent = (props = {}) => | ||
render(<MetadataSidebar {...props} />, { | ||
wrapper: ({ children }: { children: React.ReactNode }) => ( | ||
<IntlProvider locale="en-US">{children}</IntlProvider> | ||
), | ||
}); | ||
|
||
test('should render title', () => { | ||
renderComponent(); | ||
|
||
expect(screen.getByRole('heading', { level: 3, name: 'Metadata' })).toBeVisible(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ORIGIN_METADATA_SIDEBAR_REDESIGN
no longer exists - was previously the same asORIGIN_METADATA_SIDEBAR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After further consideration I decided to leave
ORIGIN_METADATA_SIDEBAR_REDESIGN
and apply it properly, so we can track the loading performance. I'm sure @jstoffan knows how.