-
-
Notifications
You must be signed in to change notification settings - Fork 736
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: rename message banners to banners (#5098)
https://linear.app/unleash/issue/2-1531/rename-message-banners-to-banners This renames "message banners" to "banners". I also added support for external banners coming from a `banner` flag instead of only `messageBanner` flag, so we can eventually migrate to the new one in the future if we want.
- Loading branch information
Showing
15 changed files
with
106 additions
and
104 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
30 changes: 30 additions & 0 deletions
30
frontend/src/component/banners/externalBanners/ExternalBanners.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,30 @@ | ||
import { Banner } from 'component/banners/Banner/Banner'; | ||
import useUiConfig from 'hooks/api/getters/useUiConfig/useUiConfig'; | ||
import { useVariant } from 'hooks/useVariant'; | ||
import { IBanner } from 'interfaces/banner'; | ||
|
||
export const ExternalBanners = () => { | ||
const { uiConfig } = useUiConfig(); | ||
|
||
const bannerVariantFromMessageBannerFlag = useVariant<IBanner | IBanner[]>( | ||
uiConfig.flags.messageBanner, | ||
); | ||
const bannerVariantFromBannerFlag = useVariant<IBanner | IBanner[]>( | ||
uiConfig.flags.banner, | ||
); | ||
|
||
const bannerVariant = | ||
bannerVariantFromMessageBannerFlag || bannerVariantFromBannerFlag || []; | ||
|
||
const banners: IBanner[] = Array.isArray(bannerVariant) | ||
? bannerVariant | ||
: [bannerVariant]; | ||
|
||
return ( | ||
<> | ||
{banners.map((banner) => ( | ||
<Banner key={banner.message} banner={banner} /> | ||
))} | ||
</> | ||
); | ||
}; |
14 changes: 14 additions & 0 deletions
14
frontend/src/component/banners/internalBanners/InternalBanners.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,14 @@ | ||
import { Banner } from 'component/banners/Banner/Banner'; | ||
import { useBanners } from 'hooks/api/getters/useBanners/useBanners'; | ||
|
||
export const InternalBanners = () => { | ||
const { banners } = useBanners(); | ||
|
||
return ( | ||
<> | ||
{banners.map((banner) => ( | ||
<Banner key={banner.id} banner={banner} /> | ||
))} | ||
</> | ||
); | ||
}; |
28 changes: 0 additions & 28 deletions
28
frontend/src/component/messageBanners/externalMessageBanners/ExternalMessageBanners.tsx
This file was deleted.
Oops, something went wrong.
17 changes: 0 additions & 17 deletions
17
frontend/src/component/messageBanners/internalMessageBanners/InternalMessageBanners.tsx
This file was deleted.
Oops, something went wrong.
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
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
Oops, something went wrong.