Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Design - Make card buttons have less vertical padding #42

Merged
merged 1 commit into from
Feb 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 13 additions & 13 deletions content/ai_exchange/content/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,21 @@
{{< spacer height="40" >}}

{{< cards >}}
{{< card link="/connect" title="Connect with us!" icon="chat" >}}
{{< card link="/contribute" title="Contribute" icon="star" >}}
{{< card link="https://forms.gle/XwEEK52y4iZQChuJ6" title="Register" icon="login" >}}
{{< card link="/media" title="Media" icon="speakerphone" >}}
{{< card link="https://github.com/OWASP/www-project-ai-security-and-privacy-guide/raw/main/assets/images/owaspaioverviewpdfv3.pdf" title="Navigator" icon="document-download">}}
{{< small-card link="/connect" title="Connect with us!" icon="chat" >}}
{{< small-card link="/contribute" title="Contribute" icon="star" >}}
{{< small-card link="https://forms.gle/XwEEK52y4iZQChuJ6" title="Register" icon="login" >}}
{{< small-card link="/media" title="Media" icon="speakerphone" >}}
{{< small-card link="https://github.com/OWASP/www-project-ai-security-and-privacy-guide/raw/main/assets/images/owaspaioverviewpdfv3.pdf" title="Navigator" icon="document-download">}}
{{< /cards >}}

## Our Content

{{< cards >}}
{{< card link="/docs/ai_security_overview/" title="AI Security Overview">}}
{{< card link="/docs/1_general_controls/" title="1. General controls">}}
{{< card link="/docs/2_threats_through_use/" title="2. Threats through use">}}
{{< card link="/docs/3_development_time_threats/" title="3. Development-time threats">}}
{{< card link="/docs/4_runtime_application_security_threats/" title="4. Runtime application security threats">}}
{{< small-card link="/docs/ai_security_overview/" title="AI Security Overview">}}
{{< small-card link="/docs/1_general_controls/" title="1. General controls">}}
{{< small-card link="/docs/2_threats_through_use/" title="2. Threats through use">}}
{{< small-card link="/docs/3_development_time_threats/" title="3. Development-time threats">}}
{{< small-card link="/docs/4_runtime_application_security_threats/" title="4. Runtime application security threats">}}
{{< /cards >}}

## Purpose
Expand All @@ -36,7 +36,7 @@ The AI Exchange is displayed here at [owaspai.org](https://owaspai.org) and edit
## Other OWASP AI Initiatives

{{< cards >}}
{{< card link="https://owasp.org/www-project-ai-security-and-privacy-guide/" title="AI security & privacy guide" icon="lock-closed" >}}
{{< card link="https://llmtop10.com/" title="LLM Top 10" icon="brain" >}}
{{< card link="https://mltop10.info/" title="ML Top 10" icon="machinelearning" >}}
{{< small-card link="https://owasp.org/www-project-ai-security-and-privacy-guide/" title="AI security & privacy guide" icon="lock-closed" >}}
{{< small-card link="https://llmtop10.com/" title="LLM Top 10" icon="brain" >}}
{{< small-card link="https://mltop10.info/" title="ML Top 10" icon="machinelearning" >}}
{{< /cards >}}
12 changes: 6 additions & 6 deletions content/ai_exchange/content/connect.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ excludeSearch: true
## Platforms

{{< cards >}}
{{< card link="https://forms.gle/XwEEK52y4iZQChuJ6" title="Register" icon="login" >}}
{{< card link="https://owasp.slack.com/join/shared_invite/zt-g398htpy-AZ40HOM1WUOZguJKbblqkw#" title="Slack" icon="slack-big" >}}
{{< card link="https://www.linkedin.com/company/owasp-ai-exchange/" title="LinkedIn" icon="linkedin" >}}
{{< card link="mailto:[email protected]" title="E-mail" icon="mail">}}
{{< card link="https://twitter.com/owasp" title="Twitter" icon="x-twitter" >}}
{{< card link="https://github.com/OWASP/www-project-ai-security-and-privacy-guide/discussions" title="GitHub" icon="github" >}}
{{< small-card link="https://forms.gle/XwEEK52y4iZQChuJ6" title="Register" icon="login" >}}
{{< small-card link="https://owasp.slack.com/join/shared_invite/zt-g398htpy-AZ40HOM1WUOZguJKbblqkw#" title="Slack" icon="slack-big" >}}
{{< small-card link="https://www.linkedin.com/company/owasp-ai-exchange/" title="LinkedIn" icon="linkedin" >}}
{{< small-card link="mailto:[email protected]" title="E-mail" icon="mail">}}
{{< small-card link="https://twitter.com/owasp" title="Twitter" icon="x-twitter" >}}
{{< small-card link="https://github.com/OWASP/www-project-ai-security-and-privacy-guide/discussions" title="GitHub" icon="github" >}}
{{< /cards >}}

Engage with the OWASP AI team through various platforms.
Expand Down
10 changes: 5 additions & 5 deletions content/ai_exchange/content/docs/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ title: Content
---

{{< cards >}}
{{< card link="/docs/ai_security_overview/" title="AI Security Overview">}}
{{< card link="/docs/1_general_controls/" title="1. General controls">}}
{{< card link="/docs/2_threats_through_use/" title="2. Threats through use">}}
{{< card link="/docs/3_development_time_threats/" title="3. Development-time threats">}}
{{< card link="/docs/4_runtime_application_security_threats/" title="4. Runtime application security threats">}}
{{< small-card link="/docs/ai_security_overview/" title="AI Security Overview">}}
{{< small-card link="/docs/1_general_controls/" title="1. General controls">}}
{{< small-card link="/docs/2_threats_through_use/" title="2. Threats through use">}}
{{< small-card link="/docs/3_development_time_threats/" title="3. Development-time threats">}}
{{< small-card link="/docs/4_runtime_application_security_threats/" title="4. Runtime application security threats">}}
{{< /cards >}}
77 changes: 77 additions & 0 deletions content/ai_exchange/layouts/shortcodes/small-card.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
<!-- original code is from Hextra Hugo theme for card.html, this just has adjusted padding -->
{{- $context := . -}}
{{- $link := .Get "link" -}}
{{- $title := .Get "title" -}}
{{- $icon := .Get "icon" -}}
{{- $subtitle := .Get "subtitle" -}}
{{- $image := .Get "image" -}}
{{- $width := 0 -}}
{{- $height := 0 -}}
{{- $imageStyle := .Get "imageStyle" -}}

{{/* Image processing options */}}
{{- $method := .Get "method" | default "Resize" | humanize -}}
{{- $options := .Get "options" | default "800x webp q80" -}}

{{- if and $image (not (urls.Parse $image).Scheme) -}}
{{/* Process images in assets */}}
{{- with resources.Get $image -}}
{{- $processed := "" -}}
{{- if eq $method "Resize" -}}
{{- $processed = (.Resize $options) -}}
{{- else if eq $method "Fit" -}}
{{- $processed = (.Fit $options) -}}
{{- else if eq $method "Fill" -}}
{{- $processed = (.Fill $options) -}}
{{- else if eq $method "Crop" -}}
{{- $processed = (.Crop $options) -}}
{{- else -}}
{{- errorf "Invalid image processing command: Must be one of Crop, Fit, Fill or Resize." -}}
{{- end -}}
{{- $width = $processed.Width -}}
{{- $height = $processed.Height -}}
{{- $image = $processed.RelPermalink -}}
{{- else -}}
{{/* Otherwise, use relative link of the image */}}
{{- if hasPrefix $image "/" -}}
{{- $image = relURL (strings.TrimPrefix "/" $image) -}}
{{- end -}}
{{- end -}}
{{- end -}}

{{ $linkClass := "hover:border-gray-300 bg-transparent shadow-sm dark:border-neutral-800 hover:bg-slate-50 hover:shadow-md dark:hover:border-neutral-700 dark:hover:bg-neutral-900" }}
{{- with $image -}}
{{ $linkClass = "hover:border-gray-300 bg-gray-100 shadow dark:border-neutral-700 dark:bg-neutral-800 dark:text-gray-50 hover:shadow-lg dark:hover:border-neutral-500 dark:hover:bg-neutral-700" }}
{{- end -}}

{{- $external := strings.HasPrefix $link "http" -}}
{{- $href := cond (strings.HasPrefix $link "/") ($link | relURL) $link -}}


<a
class="hextra-card group flex flex-col justify-start overflow-hidden rounded-lg border border-gray-200 text-current no-underline dark:shadow-none hover:shadow-gray-100 dark:hover:shadow-none shadow-gray-100 active:shadow-sm active:shadow-gray-200 transition-all duration-200 {{ $linkClass }}"
{{- if $link -}}
href="{{ $href }}" {{ with $external }}target="_blank" rel="noreferrer"{{ end -}}
{{- end -}}
>
{{- with $image -}}
<img
alt="{{ $title }}"
loading="lazy"
decoding="async"
src="{{ $image | safeURL }}"
{{ with $width }}width="{{ . }}"{{ end }}
{{ with $height }}height="{{ . }}"{{ end }}
{{ with $imageStyle }}style="{{ . | safeCSS }}"{{ end }}
/>
{{- end -}}

<span class="flex font-semibold items-start gap-2 text-gray-700 hover:text-gray-900 dark:text-neutral-200 dark:hover:text-neutral-50" style="padding: 0.5rem;">
{{- with $icon }}{{ partial "utils/icon.html" (dict "name" $icon) -}}{{- end -}}
{{- $title -}}
</span>
{{- with $subtitle -}}
<div class="line-clamp-3 text-sm font-normal text-gray-500 dark:text-gray-400 px-4 mb-4 mt-2">{{- $subtitle | markdownify -}}</div>
{{- end -}}
</a>
{{- /* Strip trailing newline. */ -}}
Loading