| Server IP : 52.25.153.185 / Your IP : 216.73.216.194 Web Server : Apache System : Linux ip-172-26-6-158 5.10.0-45-cloud-amd64 #1 SMP Debian 5.10.259-1 (2026-07-02) x86_64 User : daemon ( 1) PHP Version : 8.1.10 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /bitnami/wordpress/wp-content/plugins/code-snippets/js/components/common/ |
Upload File : |
import React from 'react'
import classnames from 'classnames'
import { __ } from '@wordpress/i18n'
import { CardViewIcon } from './icons/CardViewIcon'
import { TableViewIcon } from './icons/TableViewIcon'
import type { SnippetView } from '../../types/SnippetView'
export interface SnippetViewToggleProps {
snippetView: SnippetView
setSnippetView: (view: SnippetView) => void
className?: string
}
export const SnippetViewToggle: React.FC<SnippetViewToggleProps> = ({ snippetView, setSnippetView, className }) =>
<div
className={classnames('snippet-view-toggle', className)}
role="group"
aria-label={__('Snippet view', 'code-snippets')}
>
<button
type="button"
className={classnames('snippet-view-toggle-option', { 'active-view': 'card' === snippetView })}
aria-pressed={'card' === snippetView}
title={__('Switch to card view', 'code-snippets')}
onClick={() => setSnippetView('card')}
>
<CardViewIcon aria-hidden="true" />
<span className="screen-reader-text">{__('Card view', 'code-snippets')}</span>
</button>
<button
type="button"
className={classnames('snippet-view-toggle-option', { 'active-view': 'table' === snippetView })}
aria-pressed={'table' === snippetView}
title={__('Switch to table view', 'code-snippets')}
onClick={() => setSnippetView('table')}
>
<TableViewIcon aria-hidden="true" />
<span className="screen-reader-text">{__('Table view', 'code-snippets')}</span>
</button>
</div>