11---
2- import { Terminal , Play } from ' @lucide/astro' ;
2+ import { Terminal } from ' @lucide/astro' ;
33import CopyButton from ' ./CopyButton.astro' ;
4+ import RunButton from ' ./RunButton.astro' ;
45
56interface Props {
67 filename: string ;
@@ -10,13 +11,15 @@ interface Props {
1011 } | null ;
1112 code: string ;
1213 replitUrl? : string ;
14+ codespacesUrl? : string ;
1315}
1416
1517const {
1618 filename,
1719 annotation,
1820 code,
1921 replitUrl = ' https://replit.com/github/huangsam/ultimate-python' ,
22+ codespacesUrl = ' https://codespaces.new/huangsam/ultimate-python' ,
2023} = Astro .props ;
2124---
2225
@@ -34,18 +37,7 @@ const {
3437 </div >
3538 <div class =" action-buttons" >
3639 <CopyButton code ={ code } />
37- <a
38- href ={ replitUrl }
39- target =" _blank"
40- rel =" noopener noreferrer"
41- class =" action-btn btn-replit"
42- >
43- <span class =" btn-icon" >
44- <Play size ={ 14 } fill =" currentColor" />
45- </span >
46- <span class =" btn-text-full" >Run on Replit</span >
47- <span class =" btn-text-short" >Run</span >
48- </a >
40+ <RunButton replitUrl ={ replitUrl } codespacesUrl ={ codespacesUrl } />
4941 </div >
5042</div >
5143
@@ -112,51 +104,4 @@ const {
112104 gap: 0.75rem;
113105 flex-shrink: 0;
114106 }
115-
116- .action-btn {
117- padding: 0.5rem 0.9rem;
118- border-radius: 4px;
119- font-family: var(--font-sans);
120- font-size: 0.85rem;
121- font-weight: 500;
122- cursor: pointer;
123- border: none;
124- transition: all var(--transition-speed);
125- display: inline-flex;
126- align-items: center;
127- }
128-
129- .btn-replit {
130- background-color: #3c3c3c;
131- color: #ffffff;
132- text-decoration: none;
133- }
134-
135- .btn-replit:hover {
136- background-color: #4e4e4e;
137- }
138-
139- .btn-text-short {
140- display: none;
141- }
142-
143- .btn-icon {
144- margin-right: 0.4rem;
145- display: flex;
146- align-items: center;
147- flex-shrink: 0;
148- }
149-
150- @media (width <= 969px) {
151- .btn-text-full,
152- .btn-text-short {
153- display: none;
154- }
155- .btn-icon {
156- margin-right: 0 !important;
157- }
158- .action-btn {
159- padding: 0.5rem 0.6rem;
160- }
161- }
162107</style >
0 commit comments