1 |
- {"version":3,"sources":["../src/app/PageNav.tsx"],"names":["React","withRouter","Nav","NavList","makeNavItems","flattenContent","PageNavigation","Component","constructor","props","findActiveItem","currentPath","location","pathname","items","content","firstItem","item","itemPath","path","render","activeItem","PageNav"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA,OAAO,KAAKA,KAAZ;AACA,SAAQC,UAAR;AACA,SAAQC,GAAR,EAAaC,OAAb;AAEA,SAAQC,YAAR,EAAsBC,cAAtB;;AAQA,MAAMC,cAAN,SAA6BN,KAAK,CAACO,SAAnC,CAAyE;AAE9DC,EAAAA,WAAW,CAACC,KAAD,EAAsB;AACpC,UAAMA,KAAN;AACH;;AAEOC,EAAAA,cAAc,GAAY;AAC9B,UAAMC,WAAmB,GAAG,KAAKF,KAAL,CAAWG,QAAX,CAAoBC,QAAhD;AACA,UAAMC,KAAgB,GAAGT,cAAc,CAACU,OAAD,CAAvC;AACA,UAAMC,SAAS,GAAGF,KAAK,CAAC,CAAD,CAAvB;;AACA,SAAK,IAAIG,IAAT,IAAiBH,KAAjB,EAAwB;AACpB,YAAMI,QAAgB,GAAG,MAAMD,IAAI,CAACE,IAApC;;AACA,UAAID,QAAQ,KAAKP,WAAjB,EAA8B;AAC1B,eAAOM,IAAP;AACH;AACJ;;AAAA;AAED,WAAOD,SAAP;AACH;;AAEMI,EAAAA,MAAM,GAAoB;AAC7B,UAAMC,UAAmB,GAAG,KAAKX,cAAL,EAA5B;AACA,WACI,oBAAC,GAAD,QACI,oBAAC,OAAD,QACKN,YAAY,CAACiB,UAAD,CADjB,CADJ,CADJ;AAOH;;AA7BoE;;AAgCzE,OAAO,MAAMC,OAAO,GAAGrB,UAAU,CAACK,cAAD,CAA1B","sourcesContent":["/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport * as React from 'react';\nimport {withRouter, RouteComponentProps} from 'react-router-dom';\nimport {Nav, NavList} from '@patternfly/react-core';\n\nimport {makeNavItems, flattenContent, ContentItem, PageDef} from './ContentPages';\n\ndeclare const content: ContentItem[];\n\nexport interface PageNavProps extends RouteComponentProps {}\n\nexport interface PageNavState {}\n\nclass PageNavigation extends React.Component<PageNavProps, PageNavState> {\n\n public constructor(props: PageNavProps) {\n super(props);\n }\n\n private findActiveItem(): PageDef {\n const currentPath: string = this.props.location.pathname;\n const items: PageDef[] = flattenContent(content);\n const firstItem = items[0];\n for (let item of items) {\n const itemPath: string = '/' + item.path;\n if (itemPath === currentPath) {\n return item;\n }\n };\n\n return firstItem;\n }\n\n public render(): React.ReactNode {\n const activeItem: PageDef = this.findActiveItem();\n return (\n <Nav>\n <NavList>\n {makeNavItems(activeItem)}\n </NavList>\n </Nav>\n );\n }\n}\n\nexport const PageNav = withRouter(PageNavigation);\n"],"file":"PageNav.js"}
|