-
Notifications
You must be signed in to change notification settings - Fork 305
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(content-sidebar): Add placehoder metadatasidebar redesigned (#3570)
* feat(content-sidebar): Introduce redesigned MetadataSidebar placeholder In this new placeholder component we will be composing new experience from new components from shared-feature * feat(content-sidebar): Use isFeatureEnabled utility * feat(content-sidebar): Remove lint disabling comments * feat(content-sidebar): Rename component to MetadataSidebarRedesign * feat(content-sidebar): Rename constant value to match it's name Also use constant in mock to show they connected * feat(content-sidebar): Rename class name to follow SUIT naming * feat(content-sidebar): Remove unneeded ref and constant * feat(content-sidebar): Remove unneeded constant * feat(content-sidebar): Add performance mark for MetadataSidebarRedesign
- Loading branch information
1 parent
c0ff8d7
commit 6a0d7ee
Showing
9 changed files
with
130 additions
and
11 deletions.
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