/* * The MIT License (MIT) * * Copyright (c) 2015 - present Instructure, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ import React from 'react' import type { WithStyleProps, ComponentStyle } from '@instructure/emotion' import type { TopNavBarBrandTheme, OtherHTMLAttributes, AsElementType } from '@instructure/shared-types' import type { ViewOwnProps } from '@instructure/ui-view/v11_6' import type { TopNavBarContextType } from '../TopNavBarContext' import { TopNavBarBrand } from './index' type BrandChild = React.ComponentElement type TopNavBarBrandOwnProps = { /** * A label is required for accessibility (e.g. name). */ screenReaderLabel: string /** * The app/product/brand/company/etc. logo or icon. * The icon is not displayed in "smallViewport" mode. */ renderIcon?: React.ReactNode /** * Background color of the icon, usually the brand color (when an icon is provided). * The background is not displayed in "smallViewport" mode. */ iconBackground?: string /** * If the item goes to a new page, pass a href. */ href?: string /** * If the item does not go to a new page, pass an onClick */ onClick?: (event: React.MouseEvent) => void /** * The element type to render as (will default to `` if href is provided) */ as?: AsElementType /** * A function that returns a reference to root HTML element */ elementRef?: (el: HTMLDivElement | null) => void } type PropKeys = keyof TopNavBarBrandOwnProps type AllowedPropKeys = Readonly> type TopNavBarBrandProps = TopNavBarBrandOwnProps & WithStyleProps & OtherHTMLAttributes type TopNavBarBrandStyle = ComponentStyle< 'topNavBarBrand' | 'container' | 'name' | 'iconContainer' | 'icon' > & Pick type TopNavBarBrandStyleProps = { layout: TopNavBarContextType['layout'] } const allowedProps: AllowedPropKeys = [ 'screenReaderLabel', 'renderIcon', 'iconBackground', 'href', 'onClick', 'as', 'elementRef' ] export type { BrandChild, TopNavBarBrandProps, TopNavBarBrandOwnProps, TopNavBarBrandStyle, TopNavBarBrandStyleProps } export { allowedProps }