UNPKG

@redocly/graphql-docs

Version:

Redocly GraphQL docs

40 lines (37 loc) 1.64 kB
import{jsx as e,Fragment as c,jsxs as a}from"react/jsx-runtime";import{memo as d,useCallback as p}from"react";import{DownloadIcon as f,GraphqlIcon as m,JsonIcon as w,Button as x,FileIcon as b}from"@redocly/theme";import{styled as r}from"../../../styled-components.js";import{useDownloadInfo as g}from"./useDownloadInfo.js";function h({downloadUrls:i}){const n=g({downloadUrls:i}),s=p(o=>{switch(o){case"gql":return e(m,{});case"json":return e(w,{});default:return e(b,{})}},[]);return n?e(y,{children:(n||[]).map(({title:o,url:t,iconType:l})=>a(u,{children:[a(v,{children:[s(l),e("a",{href:t,target:"_blank",download:!0,rel:"noreferrer",children:o})]}),e("a",{href:t,target:"_blank",download:!0,rel:"noreferrer",children:e(x,{variant:"text",size:"small",icon:e(f,{})})})]},o))}):e(c,{})}const F=d(h),u=r.div` display: flex; align-items: baseline; justify-content: space-between; width: 100%; border-bottom: 1px solid var(--border-color-secondary); padding-bottom: var(--spacing-sm); :last-of-type { padding-bottom: 0px; border-bottom: none; } `,v=r.span` display: flex; width: calc(100% - 25px); gap: var(--spacing-xs); align-items: center; svg { flex-shrink: 0; } a { width: 100%; color: var(--text-color-primary); word-break: break-word; text-decoration: none; text-overflow: ellipsis; overflow: hidden; white-space: nowrap; } `,y=r.div` display: flex; align-items: center; align-self: flex-start; justify-content: space-between; flex-direction: column; gap: var(--spacing-sm); font-size: var(--font-size-base); `;export{F as DownloadSpecification};