-
Notifications
You must be signed in to change notification settings - Fork 167
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: Public layout component #3208
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3208 +/- ##
=======================================
Coverage 96.42% 96.43%
=======================================
Files 791 793 +2
Lines 22605 22659 +54
Branches 7814 7839 +25
=======================================
+ Hits 21797 21851 +54
Misses 754 754
Partials 54 54 ☔ View full report in Codecov by Sentry. |
pages/page-layout/styles.scss
Outdated
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.
These styles were copied from pages/app-layout
…mponent # Conflicts: # src/__tests__/snapshot-tests/__snapshots__/test-utils-wrappers.test.tsx.snap
…vided nor at least one drawer with trigger
…mponent # Conflicts: # src/app-layout/visual-refresh-toolbar/multi-layout.ts
@@ -0,0 +1,169 @@ | |||
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. |
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.
This content is not connected to anything in app layout, so I think it is fine to reuse it instead of copying
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.
done
src/split-panel/implementation.tsx
Outdated
const isToolbar = useAppLayoutToolbarEnabled(); | ||
const isToolbarPrivate = useAppLayoutToolbarEnabled(); | ||
const isToolbarPublic = useContext(AppLayoutToolbarPublicContext) ?? false; | ||
const isToolbar = isToolbarPublic || isToolbarPrivate; |
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.
Did you count how many times we the combined condition isToolbarPublic || isToolbarPrivate
? Would it be better to have a reusable utility for this too?
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.
I think it's a case when keeping this condition explicit would be more helpful than abstracting it out. Do you think it's worth to do it?
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.
Yes, it is definitely worth to have a reusable utility that gives you "we are under app layout toolbar" value with a one-line import
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.
done
beforeEach(() => { | ||
globalWithFlags[Symbol.for('awsui-visual-refresh-flag')] = () => true; | ||
}); | ||
|
||
afterEach(() => { | ||
delete globalWithFlags[Symbol.for('awsui-visual-refresh-flag')]; | ||
clearVisualRefreshState(); | ||
}); |
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.
I think these changes in src/__tests__/**
files is another instance of something to extract as a separate PR and merge before the main one lands.
P.S. I think we also need to send a PSA to our team that the default behavior of these tests changed
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.
These conditions (set refresh feature flag before running the tests suites) make sense only for this PR as it checks the AppLayoutToolbar
component for classic theme. What exactly would you suggest to do? Implement these feature flag via useVisualRefresh
and then change it as a follow-up PR to separate concerns?
On the one hand it makes sense, on the other hand, I would go ahead as is and let our team know about this decision. WDYT?
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.
With this change we switch tests to use VR version by default, for all components. not only app layout.
So I suggest making this switch as a separate PR
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.
Switched to useVisualRefresh
. I'll switch it back to globalWithFlags[Symbol.for('awsui-visual-refresh-flag')]
in a separate PR
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.
Discussed offline, let's undo the change about useVisualRefresh
and keep it this way until the PR is merged
…] to useVisualRefresh in functional tests
@@ -7,6 +7,7 @@ import { warnOnce } from '@cloudscape-design/component-toolkit/internal'; | |||
import { awsuiPluginsInternal } from '../../internal/plugins/api'; | |||
import { RegistrationState } from '../../internal/plugins/controllers/app-layout-widget'; | |||
import { AppLayoutProps } from '../interfaces'; | |||
import { useAppLayoutToolbarEnabled } from '../utils/feature-flags'; |
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.
Let's rename these hooks
- useAppLayoutFlagEnabled – the feature flags are active (for all advanced deduplication features)
- useAppLayoutToolbarDesignEnabled - same as above, but also true when toolbar is used standalone
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.
done
beforeEach(() => { | ||
globalWithFlags[Symbol.for('awsui-visual-refresh-flag')] = () => true; | ||
}); | ||
|
||
afterEach(() => { | ||
delete globalWithFlags[Symbol.for('awsui-visual-refresh-flag')]; | ||
clearVisualRefreshState(); | ||
}); |
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.
Discussed offline, let's undo the change about useVisualRefresh
and keep it this way until the PR is merged
…h-flag')] to useVisualRefresh in functional tests" This reverts commit 273633b.
Description
doc: tb1MA6m8ZZEt
Related links, issue #, if available: n/a
How has this been tested?
Review checklist
The following items are to be evaluated by the author(s) and the reviewer(s).
Correctness
CONTRIBUTING.md
.CONTRIBUTING.md
.Security
checkSafeUrl
function.Testing
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.