Skip to content

Commit

Permalink
Components: Migrate MarkedLines component from Jetpack Protect (#39674)
Browse files Browse the repository at this point in the history
  • Loading branch information
nateweller authored Oct 13, 2024
1 parent 2761a42 commit 8af02a6
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: minor
Type: added

Add MarkedLines component
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Marked Lines viewer

Forked over from [Calypso](https://github.com/Automattic/wp-calypso/tree/b7a4a07/client/components/marked-lines).
Originally forked over from [Calypso](https://github.com/Automattic/wp-calypso/tree/b7a4a07/client/components/marked-lines).

This component is designed to show contextualized lines from a file with
optional highlighting or marks to point out specific parts of one or more lines.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
/* eslint-disable react/react-in-jsx-scope */
import React from 'react';
import MarkedLines from '../index.jsx';
import MarkedLines from '../index.js';

export default {
title: 'Plugins/Protect/Marked Lines',
title: 'JS Packages/Components/Marked Lines',
component: MarkedLines,
};

Expand All @@ -15,6 +13,7 @@ export const Default = args => (
} }
/>
);

Default.args = {
lines: {
10: 'add :: Num a => a -> a -> a',
Expand Down
1 change: 1 addition & 0 deletions projects/js-packages/components/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,4 +79,5 @@ export { default as UpsellBanner } from './components/upsell-banner';
export { getUserLocale, cleanLocale } from './lib/locale';
export { default as RadioControl } from './components/radio-control';
export { default as StatCard } from './components/stat-card';
export { default as MarkedLines } from './components/marked-lines';
export * from './components/global-notices';
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: changed

Use MarkedLines component from package
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import { Text, Button, useBreakpointMatch } from '@automattic/jetpack-components';
import { Text, Button, MarkedLines, useBreakpointMatch } from '@automattic/jetpack-components';
import { __, sprintf } from '@wordpress/i18n';
import React, { useCallback } from 'react';
import useAnalyticsTracks from '../../hooks/use-analytics-tracks';
import useFixers from '../../hooks/use-fixers';
import useModal from '../../hooks/use-modal';
import DiffViewer from '../diff-viewer';
import MarkedLines from '../marked-lines';
import PaidAccordion, { PaidAccordionItem } from '../paid-accordion';
import Pagination from './pagination';
import styles from './styles.module.scss';
Expand Down

0 comments on commit 8af02a6

Please sign in to comment.