Skip to content

Commit

Permalink
Merge branch 'main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
aelmanaa authored Jan 15, 2025
2 parents b2e68f5 + 94497df commit e474b44
Show file tree
Hide file tree
Showing 182 changed files with 13,269 additions and 3,060 deletions.
2 changes: 1 addition & 1 deletion CODEOWNERS
Original file line number Diff line number Diff line change
@@ -1 +1 @@
* @dwightjl @aelmanaa @thedriftofwords @khadni
* @gfletcher-cll @aelmanaa @thedriftofwords @khadni
187 changes: 187 additions & 0 deletions SIDE_BY_SIDE_CODE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,187 @@
# SideBySideCode Component

A modern, accessible component for displaying code alongside explanatory content. Perfect for documentation, tutorials, and educational content.

## Features

- 🎯 Side-by-side display of code and explanations
- 🔍 Syntax highlighting with Shiki
- 📍 Interactive line highlighting
- 📋 One-click code copying
- 🌐 Load code from local files or URLs
- 📱 Responsive design
- ♿ WCAG AA compliant

## Basic Usage

```mdx
import { SideBySideCode } from "@components"

<SideBySideCode language="solidity" codeSrc="/samples/example.sol" title="Example.sol">
This is where you put your explanation text. It will appear alongside the code.
</SideBySideCode>
```

## Loading Code

The component supports two methods for loading code:

### 1. Local Files

Place your code files in the `public/samples` directory and reference them with a relative path:

```mdx
<SideBySideCode language="javascript" codeSrc="/samples/example.js" title="Example.js">
Explanation goes here...
</SideBySideCode>
```

### 2. Remote URLs

Load code directly from any HTTP(S) URL:

```mdx
<SideBySideCode
language="python"
codeSrc="https://raw.githubusercontent.com/user/repo/main/example.py"
title="Example.py"
>
Explanation goes here...
</SideBySideCode>
```

## Interactive Line Highlighting

Highlight specific lines of code to draw attention to important sections:

```mdx
<SideBySideCode
language="typescript"
codeSrc="/samples/example.ts"
title="Example.ts"
highlights={[
{
lines: [1, 2, 3],
label: "Imports",
description: "Import required dependencies",
},
{
lines: [5, 6, 7],
label: "Configuration",
description: "Set up the configuration object",
},
]}
>
The highlights will create interactive cards that, when clicked, will highlight the corresponding lines of code.
</SideBySideCode>
```

## Props Reference

| Prop | Type | Required | Description |
| ------------ | ----------- | -------- | ---------------------------------------------------------------------- |
| `language` | `string` | No | Programming language for syntax highlighting. Defaults to "plaintext". |
| `codeSrc` | `string` | Yes | Path to local file (in public/samples) or HTTP(S) URL. |
| `title` | `string` | No | Title displayed in the code header. |
| `highlights` | `Array` | No | Array of line highlights (see structure below). |
| `children` | `ReactNode` | No | Explanatory content to display alongside the code. |

### Highlight Structure

```typescript
interface LineHighlight {
lines: number[] // Array of line numbers to highlight
label: string // Short label for the highlight
description: string // Detailed description
}
```

## Supported Languages

The component supports syntax highlighting for:

- JavaScript/TypeScript
- Solidity
- Python
- And many more...

For a complete list, refer to [Shiki's supported languages](https://github.com/shikijs/shiki/blob/main/docs/languages.md).

## Best Practices

1. **Concise Explanations**

- Keep explanations clear and focused
- Use bullet points for better readability
- Highlight only the most important code sections

2. **Responsive Design**

- Component automatically adjusts for different screen sizes
- Code and explanation stack vertically on mobile
- Maintains readability across devices

3. **Accessibility**
- Use descriptive labels for highlights
- Ensure good color contrast in explanations
- Provide meaningful titles for code sections

## Examples

### Basic Example

```mdx
<SideBySideCode language="javascript" codeSrc="/samples/hello.js" title="Hello World">
A simple hello world example in JavaScript.
</SideBySideCode>
```

### With Highlights

```mdx
<SideBySideCode
language="solidity"
codeSrc="/samples/contract.sol"
title="Smart Contract"
highlights={[
{
lines: [1, 2],
label: "SPDX License",
description: "Specify the license for the contract",
},
]}
>
This smart contract demonstrates basic functionality. Click on the highlight cards to focus on specific sections.
</SideBySideCode>
```

### Loading from URL

```mdx
<SideBySideCode language="python" codeSrc="https://api.example.com/code/script.py" title="Python Script">
This code is loaded directly from a URL.
</SideBySideCode>
```

## Troubleshooting

1. **Code Not Loading**

- For local files: Ensure the file exists in `public/samples`
- For URLs: Verify the URL is accessible and returns raw code
- Check file permissions and CORS settings

2. **Syntax Highlighting Issues**

- Verify the language is supported
- Check the language identifier is correct
- Ensure code is properly formatted

3. **Layout Problems**
- Clear any conflicting CSS
- Ensure parent container allows for proper width
- Check for proper MDX import syntax

## Contributing

We welcome contributions! Please see our contributing guidelines for more details.
12 changes: 12 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@
"@project-serum/anchor": "^0.26.0",
"@rollup/plugin-yaml": "^4.1.2",
"@types/node": "^20.12.12",
"@types/node-fetch": "^2.6.12",
"@types/prismjs": "^1.26.4",
"@types/react": "^18.3.3",
"@typescript-eslint/eslint-plugin": "^5.62.0",
Expand Down
10 changes: 10 additions & 0 deletions public/assets/chains/sonic.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
48 changes: 47 additions & 1 deletion public/changelog.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,50 @@
[
{
"category": "feature",
"changes": [],
"date": "2025-01-14",
"description": "Chainlink CCIP now supports Bridged USDC, addressing the critical challenge of liquidity fragmentation in the multi-chain ecosystem. This enhancement enables:\n\n- **Seamless Liquidity**: Projects can now leverage Bridged USDC to bootstrap initial liquidity on new chains without waiting for native USDC support\n- **Standardized Implementation**: Follows Circle's Bridged USDC Standard, ensuring consistency and reliability across different blockchains\n- **Future-Proof Integration**: Projects can easily transition to native USDC when their blockchain receives CCTP approval, with no disruption to existing integrations\n- **Enhanced DeFi Accessibility**: Accelerates DeFi adoption by providing immediate access to stable, reliable USDC liquidity across emerging blockchain networks\n\nThis implementation maintains CCIP's robust security features while expanding the possibilities for cross-chain token transfers and DeFi applications.\n\nFor more information, see the [USDC tutorial](https://docs.chain.link/ccip/tutorials/usdc).",
"relatedNetworks": [],
"relatedTokens": [],
"title": "Bridged USDC Support in CCIP",
"topic": "ccip",
"urls": []
},
{
"category": "feature",
"changes": [],
"date": "2025-01-14",
"description": "The Token Manager is now available to help token developers to deploy, configure, and manage Cross-Chain Tokens (CCTs) in a simplified web interface. Refer to the [Token Manager](https://docs.chain.link/ccip/tutorials/token-manager) guide for more information.",
"relatedNetworks": [],
"relatedTokens": [],
"title": "Token Manager",
"topic": "ccip",
"urls": []
},
{
"category": "integration",
"changes": [],
"date": "2025-01-14",
"description": "Chainlink Data Feeds is available on Sonic mainnet. View the available price feed information on the [Price Feed Addresses](https://docs.chain.link/data-feeds/price-feeds/addresses?network=sonic&page=1) page.",
"relatedNetworks": ["sonic"],
"relatedTokens": [],
"title": "Data Feeds on Sonic",
"topic": "data",
"subTopic": "data-feeds",
"urls": []
},
{
"category": "integration",
"changes": [],
"date": "2025-01-09",
"description": "Chainlink Data Feeds is available on Aptos mainnet. View the available price feed information on the [Price Feed Addresses](https://docs.chain.link/data-feeds/price-feeds/addresses?network=aptos&page=1) page.",
"relatedNetworks": ["aptos"],
"relatedTokens": [],
"title": "Data Feeds on Aptos",
"topic": "data",
"subTopic": "data-feeds",
"urls": []
},
{
"category": "integration",
"changes": [],
Expand Down Expand Up @@ -694,7 +740,7 @@
"description": "Chainlink CCIP is available in early access on the following mainnet chains:\n\n- Ethereum Sepolia\n- Optimism Goerli\n- Avalanche Fuji\n- Arbitrum Goerli\n- Polygon Mumbai\n\nSee the [CCIP Directory](https://docs.chain.link/ccip/directory/testnet) page for more information.",
"relatedNetworks": ["ethereum", "optimism", "avalanche", "polygon"],
"relatedTokens": [],
"title": "CCIP Mainnet Early Access",
"title": "CCIP Testnet Early Access",
"topic": "ccip",
"urls": []
},
Expand Down
Loading

0 comments on commit e474b44

Please sign in to comment.