1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-01-06 00:07:44 +01:00
unleash.unleash/frontend/src/component/common
Thomas Heartman c7bb6c5179
fix: prevent long project names from blowing out the form (#7673)
This change prevents long project names from blowing the form out of
proportion.

To do so, it:
1. sets `whitespace: no-wrap` on the button labels. Judging by the other
styles, this was the intention all along, but it didn't really come up
until now.

2. It also sets the label width for projects to 30ch,so that you'll get
to see quite a bit of the project name before it gets cut off.

It would be possible to set a dynamic width for this button based on the
longest project name, but I'm not sure it adds much value, so I'm
leaning towards keeping it simple.

Here's what the dynamic width would look like:

``` tsx
    const projectButtonLabelWidth = useMemo(() => {
        const longestProjectName = projects.reduce(
            (prev: number, type: { name: string }) =>
                prev >= type.name.length ? prev : type.name.length,
            0,
        );
        return `${Math.min(longestProjectName, 30)}ch`;
    }, [projects]);
```

What it looks like:

![image](https://github.com/user-attachments/assets/51bca3f6-aeb3-4a41-b57e-5ebd9baa3ef6)
2024-07-26 11:39:43 +02:00
..
AnimateOnMount feat: upgrade from react v17 to v18 (#7265) 2024-06-11 13:59:52 +03:00
Announcer
ApiError
ApiTokenTable feat: show orphaned API tokens (#7569) 2024-07-11 14:06:22 +02:00
AutocompleteBox
Badge
BatchSelectionActionsBar feat: upgrade from react v17 to v18 (#7265) 2024-06-11 13:59:52 +03:00
BreadcrumbNav Insights layout (#7610) 2024-07-18 12:43:52 +02:00
CheckmarkBadge
Codebox
ConditionallyRender
ConstraintAccordion feat: upgrade from react v17 to v18 (#7265) 2024-06-11 13:59:52 +03:00
CreateButton
DateTimePicker
DialogFormTemplate fix: prevent long project names from blowing out the form (#7673) 2024-07-26 11:39:43 +02:00
Dialogue feat: upgrade from react v17 to v18 (#7265) 2024-06-11 13:59:52 +03:00
DividerText
DropdownMenu
EnterpriseBadge
EnvironmentIcon
ExperimentalFeedback
FavoriteIconButton
FeatureArchiveDialog
FeatureStaleDialog
FeatureStatusChip
Feedback
FilterDateItem feat: upgrade from react v17 to v18 (#7265) 2024-06-11 13:59:52 +03:00
FormSwitch
FormTemplate fix: project icon sizing and color (#7672) 2024-07-26 10:26:16 +02:00
GeneralSelect fix: prevent long names from breaking form layouts (#7591) 2024-07-16 10:47:46 +02:00
Gradient feat: upgrade from react v17 to v18 (#7265) 2024-06-11 13:59:52 +03:00
GridCol feat: upgrade from react v17 to v18 (#7265) 2024-06-11 13:59:52 +03:00
GridRow feat: upgrade from react v17 to v18 (#7265) 2024-06-11 13:59:52 +03:00
GuidanceIndicator feat: upgrade from react v17 to v18 (#7265) 2024-06-11 13:59:52 +03:00
HelpIcon
Highlighter
HtmlTooltip fix: prevent project cell overflow on api keys table (#7472) 2024-07-02 12:10:02 +02:00
Input chore: update input field text sizes (#7107) 2024-05-22 13:26:22 +02:00
InputCaption
InputListField
InstanceStatus feat: upgrade from react v17 to v18 (#7265) 2024-06-11 13:59:52 +03:00
ItemList
Limit chore: don't ask OSS users to reach out to CS (#7633) 2024-07-22 11:03:10 +02:00
Loader fix: make loader not exlpode to 100vh in unnecessary locations (#7589) 2024-07-15 14:41:45 +02:00
LoginRedirect
MainHeader
Markdown
MultiActionButton feat: upgrade from react v17 to v18 (#7265) 2024-06-11 13:59:52 +03:00
MultipleRoleSelect feat: upgrade from react v17 to v18 (#7265) 2024-06-11 13:59:52 +03:00
NewConstraintAccordion feat: constraints values limit in a strategy UI (#7557) 2024-07-08 15:08:16 +02:00
NoItems feat: upgrade from react v17 to v18 (#7265) 2024-06-11 13:59:52 +03:00
NotFound feat: upgrade from react v17 to v18 (#7265) 2024-06-11 13:59:52 +03:00
Notifications feat: upgrade from react v17 to v18 (#7265) 2024-06-11 13:59:52 +03:00
OperatorUpgradeAlert
PageContent feat: upgrade from react v17 to v18 (#7265) 2024-06-11 13:59:52 +03:00
PageHeader feat: upgrade from react v17 to v18 (#7265) 2024-06-11 13:59:52 +03:00
PasswordField
PercentageCircle
PermissionButton feat: upgrade from react v17 to v18 (#7265) 2024-06-11 13:59:52 +03:00
PermissionGuard
PermissionHOC
PermissionIconButton Feat: feature view created by field - frontend (#7382) 2024-06-13 13:00:57 +02:00
PermissionSwitch chore: use HTML (custom) tooltip for permission switches (#7355) 2024-06-11 14:03:35 +02:00
PremiumFeature
PrettifyLargeNumber
Proclamation
ProjectIcon fix: project icon sizing and color (#7672) 2024-07-26 10:26:16 +02:00
ProjectSelect
ProtectedRoute
ReactJSONEditor
ResponsiveButton feat: upgrade from react v17 to v18 (#7265) 2024-06-11 13:59:52 +03:00
RoleBadge
RoleDescription
RoleSelect
ScreenReaderOnly feat: filter by user when interacting with the avatar (#7347) 2024-06-11 12:15:35 +02:00
ScrollTop
Search feat: separate command bar and search hotkeys (#7651) 2024-07-24 12:46:03 +03:00
SegmentItem fix: show segment details in targetting (#6640) 2024-03-22 10:14:19 +01:00
SidebarModal chore: Bump biome and configure husky (#6589) 2024-03-18 13:58:05 +01:00
SidePanelList
SkipNavLink
StaleDataNotification
Sticky feat: upgrade from react v17 to v18 (#7265) 2024-06-11 13:59:52 +03:00
StrategyItemContainer feat: upgrade from react v17 to v18 (#7265) 2024-06-11 13:59:52 +03:00
StrategySeparator
StrategyVariantsUpgradeAlert
StringTruncator
Table API tokens - virtualized table (#7531) 2024-07-09 13:22:55 +02:00
TabNav feat: upgrade from react v17 to v18 (#7265) 2024-06-11 13:59:52 +03:00
ThemeMode
ToastRenderer
TooltipLink
TooltipResolver feat: command menu items can have description as tooltip now (#7455) 2024-06-26 12:39:53 +03:00
UpdateButton
UserAvatar fix: add workaround for tooltip (#7649) 2024-07-24 09:33:29 +00:00
VariantInfoAlert
VerticalTabs fix: project settings table overflow (#7288) 2024-06-05 14:05:41 +02:00
common.module.scss
flags.ts
index.jsx
select.tsx
util.test.ts fix: prevent strategy variant weight from going into negative numbers on Frontend (#7460) 2024-06-27 09:06:59 +00:00
util.ts fix: prevent strategy variant weight from going into negative numbers on Frontend (#7460) 2024-06-27 09:06:59 +00:00