chromium/ios/chrome/browser/ui/content_suggestions/magic_stack/magic_stack_constants.mm

// Copyright 2024 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#import "ios/chrome/browser/ui/content_suggestions/magic_stack/magic_stack_constants.h"

NSString* const kMostVisitedSectionIdentifier = @"MostVisitedSectionIdentifier";
NSString* const kMagicStackSectionIdentifier = @"MagicStackSectionIdentifier";
NSString* const kMagicStackEditSectionIdentifier =
    @"MagicStackEditSectionIdentifier";

const int kModuleMaxHeight = 150;

const CGFloat kMagicStackSpacing = 12.0f;

const CGFloat kMagicStackPeekInset = kMagicStackSpacing;
const CGFloat kMagicStackPeekInsetLandscape = kMagicStackSpacing * 2 + 18;

const float kBottomMagicStackPadding = 14.0f;

const float kMagicStackMinimumPaginationScrollVelocity = 0.2f;

const float kMagicStackEditButtonWidth = 61;
const float kMagicStackEditButtonIconPointSize = 22;

const float kMagicStackEditButtonMargin = 32;

NSString* const kMagicStackEditButtonContainerAccessibilityIdentifier =
    @"MagicStackEditButtonContainerAccessibilityIdentifier";

NSString* const kMagicStackEditButtonAccessibilityIdentifier =
    @"MagicStackEditButtonAccessibilityIdentifier";

CGFloat ModuleNarrowerWidthToAllowPeekingForTraitCollection(
    UITraitCollection* traitCollection) {
  BOOL isLandscape = [[UIDevice currentDevice] orientation] ==
                         UIDeviceOrientationLandscapeRight ||
                     [[UIDevice currentDevice] orientation] ==
                         UIDeviceOrientationLandscapeLeft;
  BOOL isLargerWidthLayout =
      traitCollection.horizontalSizeClass == UIUserInterfaceSizeClassRegular ||
      isLandscape;
  // For the narrow width layout, make the module just slightly narrower than
  // the inter-module spacing so the UICollectionView renders the adjacent
  // module(s).
  return isLargerWidthLayout ? kMagicStackPeekInsetLandscape
                             : kMagicStackSpacing + 1;
}